SQL1159 DB2 .NET 数据提供程序的初始化错误,原因代码 10,令牌 0.0.0、9.7.3

1

本文介绍了SQL1159 DB2 .NET 数据提供程序的初始化错误,原因代码 10,令牌 0.0.0、9.7.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试在控制台应用程序中打开与 DB2 的连接.它工作正常.当我在托管在 IIS 中的服务中使用相同的代码时,它会为 DB2 引发错误.以下是错误详情.我是否缺少 IIS 中的某些权限?

dll :IBM.data.DB2.dll

代码:

DB2Connection db2Connection = new DB2Connection(connectionString);DB2Command cmdSelectUsrNameAndPassword = new DB2Command(querySelectUsernameAndPassword, db2Connection);cmdSelectUsrNameAndPassword.Connection.Open();

投掷:

<块引用>

SQL1159 DB2 .NET 数据提供程序初始化错误,原因码 10,令牌 0.0.0、9.7.3

如果我在控制台中尝试使用 ODBC 的 DSN,它可以工作,但同样会在 IIS 中引发另一个错误.

OdbcConnection DbConnection = new OdbcConnection(DSNName);DbConnection.Open();

投掷:

<块引用>

ASP.NET V4.0 无权执行请求的命令或操作.

解决方案

猜猜它与应用程序池身份有关.我将应用程序池标识设置为网络服务",并在 C:Program FilesIBMSQLLIBBIN etf20_32 中的IBM.Data.DB.dll"上授予网络服务"的完全权限.p>

I am trying to open a connection to DB2 in console application. It works fine. when I use the same code in a service, hosted in IIS it throws an error for DB2. Following is the error details. Am I missing some permissions in IIS ?

dll :IBM.data.DB2.dll

Code :

DB2Connection db2Connection = new DB2Connection(connectionString);
DB2Command cmdSelectUsrNameAndPassword = new DB2Command(querySelectUsernameAndPassword, db2Connection);
cmdSelectUsrNameAndPassword.Connection.Open();

Throws :

SQL1159 Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.3

If I try a DSN with ODBC in console it works, but same throws another error in IIS.

OdbcConnection DbConnection = new OdbcConnection(DSNName);
DbConnection.Open();

Throws :

ASP.NET V4.0 does not have the authority to perform the requested command or operation.

解决方案

guess it has something to do with App pool identity. I set the app pool identity as "Network service" and gave full permission to "Network Service" on "IBM.Data.DB.dll" in C:Program FilesIBMSQLLIBBIN etf20_32 Worked neat.

这篇关于SQL1159 DB2 .NET 数据提供程序的初始化错误,原因代码 10,令牌 0.0.0、9.7.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

函数委托与函数
Func Delegate vs Function(函数委托与函数)...
2023-11-11 C#/.NET开发问题
6

针对委托检查 MethodInfo
Checking a MethodInfo against a delegate(针对委托检查 MethodInfo)...
2023-11-11 C#/.NET开发问题
7

如何从 lambda 表达式中获取引用实例的实例
How to get the instance of a referred instance from a lambda expression(如何从 lambda 表达式中获取引用实例的实例)...
2023-11-11 C#/.NET开发问题
4

如何为具有空目标的实例方法创建委托?
How to create a delegate to an instance method with a null target?(如何为具有空目标的实例方法创建委托?)...
2023-11-11 C#/.NET开发问题
6