在SQL Server CLR过程中使用OLEDB驱动程序的问题

时间:2023-01-16 15:41:34

we are trying to create C# CLR Stored Procedure on a SQL Server 2005 machine. The C# code connects to an external datasource via an OLEDB driver to get a datatable. It has been tested on a separate console application, and it runs without problems. (The OLEDEB Driver is a proprietary driver connecting to a proprietary DB...)

我们正在尝试在SQL Server 2005计算机上创建C#CLR存储过程。 C#代码通过OLEDB驱动程序连接到外部数据源以获取数据表。它已经在一个单独的控制台应用程序上进行了测试,并且运行没有问题。 (OLEDEB驱动程序是连接到专有数据库的专有驱动程序...)

On SQL Server, we have set the EXTERNAL permission level on the assembly, it is StrongNamed and an ASSYMETRIC KEY has been created for it in the SQL Server.

在SQL Server上,我们在程序集上设置了EXTERNAL权限级别,它是StrongNamed,并且已在SQL Server中为它创建了ASSYMETRIC KEY。

When we try to execute the procedure we get the following two problems:

当我们尝试执行该过程时,我们会遇到以下两个问题:

  • Credentials used to contact the OLEDB are the ones that the SQL Service are running under, and not credentials of the logged user in the sql contect

    用于联系OLEDB的凭据是运行SQL Service的凭据,而不是sql竞争中记录的用户的凭据

  • a .NET Framework is raised :

    引发了.NET Framework:

    System.Security.SecurityException: Request for the permission of type System.Data.OleDb.OleDbPermission

    System.Security.SecurityException:请求System.Data.OleDb.OleDbPermission类型的权限

It seems that we cannot manage to give the necessary rights to the process for it to run the oledb driver. Either that or our configuration is lacking, or we are just doing something wrong. Setting permission level to UNSAFE is also not an option...

似乎我们无法设法为其运行oledb驱动程序提供必要的权限。或者我们的配置缺乏,或者我们只是做错了什么。将权限级别设置为UNSAFE也不是一种选择......

Does anybody have any experience with this type of problems. Any input would be welcome!

有没有人有这类问题的经验。任何意见都欢迎!

1 个解决方案

#1