Search code examples
asp.netiisdb2

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


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.


Solution

  • 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 Files\IBM\SQLLIB\BIN\netf20_32\ Worked neat.