[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

ODBC Connectivity in asp .net has simply stopped working, but only for .net.

Asked by baijajusav in Programming for ASP.NET, C# Programming Language, .NET Framework 2.x

Tags: odbc, db2, .net, SQL1092N, authority


I'm getting some very strange errors on boiler plate odbc connection code. The code connects to DB2 (which is always a joy to work with) and has never given me issues in the past. This is your typical work ghost....one day it just stopped working. This is happening on 2 separate instances of Windows 2003 servers. On my local machine the code works fine. The code is connecting via a system dsn setup via the IBM DB2 CONNECT components.

One error I get reads:

ERROR [08004] [IBM][CLI Driver] SQL1092N "ASPNET" does not have the authority to perform the requested command.

This happens even after I place the ASPNET account in both the DB2ADMINS and DB2USERS groups. I know the DB2USERS group should have permissions enough, but I tried DB2ADMINS just for kicks, yet neither of them work.

In my other applcation, which is using the exact same system dsn (well, it's trying to anyhow), The error message is simply blank....there isn't one. The stack trace reads:

at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
   at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
   at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.Odbc.OdbcConnection.Open()
   at code class ... line xxx            //abridged
   at form class ... line xxx             //abridged

I'm at an utter loss here...it worked....and now it doesn't...

Here is the odbc code:

 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
 String dsn = ConfigurationManager.AppSettings.Get("DSN");
  String con = ConfigurationManager.ConnectionStrings[dsn].ToString(); // con evaluates to "DSN=MYSYSDSN"
  OdbcConnection conn = new OdbcConnection(con);
  OdbcCommand command = new OdbcCommand(Constants.SQL_GET_DATA, conn);
  command.CommandType = CommandType.Text; 
  OdbcParameter param1 = new OdbcParameter("@param1", param1value);
  OdbcParameter param2 = new OdbcParameter("@param2", param2value); 
  // Add the account number & note number parameter values.
  command.Parameters.Add( param1 );
  command.Parameters.Add( param2 ); 
  OdbcDataReader rdr = null; 
  try
  { 
      conn.Open();    //errors here w/ above stack trace and an empty message string
      .....
[+][-]11/03/09 12:02 PM, ID: 25732925Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 04:32 AM, ID: 25738630Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/09 07:11 AM, ID: 25759749Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625