I just wanted to pass on recent experience I gained whilst developing a .Net application that used QODBC as I think this will help other people.
Basically my application used simple ADO.NET commands to populate a DataAdapter using a Stored Procedure. The Stored Proc was held in a SQL Database and utilised a Linked Server to get to the QODBC data source. I didn't think I was asking the system to do anything complicated but when I began to debug my application I was getting the following error when populating my dataset;
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "QODBC".
I tested my Stored Proc from within SQL Management Studio and it was returning the expected response without a problem. So, what was causing the error? I trawled through the forum to find answers, checked all my QODBC settings and then noticed one minor difference between my Stored proc call in my .Net application and using SQL Management Studio - the security context.
In my .Net application, I had been opening my database connection as a different user to the one for SQL Management Studio. When I created a new connection in SQL Management Studio using the same credentials as my .Net application and ran the Stored Proc again, I got the same error. This time it also gave me a few more pointers to the problem;
OLE DB provider "MSDASQL" for linked server "QODBC" returned message "[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed". OLE DB provider "MSDASQL" for linked server "QODBC" returned message "[QODBC] QB Begin Session Failed. Error = 80040421, The specified user is already logged in on another machine.
My QODBC connection was created originally when I was doing my testing through SQL Management Studio. When I tried to get my .Net application to connect to the same QODBC data source using a different set of credetials, it was returning the error. So, I killed the qbw32.exe process, re-ran my .Net application and got a successful result - my dataset was successfully populated.
I hope this helps other QODBC users.
Al |