[urgent!]SQLGetDiagRec cannot trace into driver when the driver is upgraded from 2.x to 3.5

16 views
Skip to first unread message

aih...@gmail.com

unread,
Jul 16, 2008, 4:34:33 AM7/16/08
to
Hi,

We have an odbc driver developped based on ODBCSDK2.x originally and
now upgrading it to ODBCSDK3.x.

To support ODBC3.x, I implement SQLGetDiagRec to replace SQLError in
the driver. However, I cannot trace into SQLGetDiagRec in my driver
after SQLConnect failure, and SQLGetDiagRec aways return 100
(SQL_NO_DATA).

This is a sample code:

ReturnCode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
ReturnCode = SQLSetEnvAttr(henv,SQL_ATTR_ODBC_VERSION,
(void*)SQL_OV_ODBC3,0);
ReturnCode = SQLAllocHandle (SQL_HANDLE_DBC,henv,&hdbc);

/* below SQLConnect return -1, but the SQLGetDiagRec cannot get the
error. In fact, SQLGetDiagRec used the DBMS copy instead of
stepping into our driver*/
ReturnCode = SQLConnect(hdbc, DSN_Name, (SWORD) strlen(DSN_Name),
szUID, USERIDLEN, szAuthStr, PASSWORDLEN );
/* we call SQLGetDiagRec to get the error in SQLConnect, but
SQLGetDiagRec always return 100 (SQL_NO_DATA) and it does not step
into the driver at all.
RC = SQLGetDiagRec(
SQL_HANDLE_DBC,
hdbc,
1,
szSqlState,
&fNativeError,
szErrorMsg,
SQL_MAX_MESSAGE_LENGTH-1,
&cbErrorMsg);

Any idea? Any infomation will be appricatable.

Pak-Ming Cheung [MSFT]

unread,
Jul 17, 2008, 3:31:01 AM7/17/08
to
Since DM maps SQLConnect into a number of driver calls, could you tell me
which driver calls return SQL_ERROR (usually, DM returns SQL_ERROR to
application when one of the driver calls failed).

This information is very important to troubleshoot this problem, which may
be due to a bug inside DM.

Which OS, Service pack are you using?

Thanks,
Ming.
MDAC Team, Microsoft.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

suku.p...@teknowmics.co.in

unread,
Aug 18, 2014, 5:23:23 AM8/18/14
to
Hi Expert,

I am using windows server 2008 R2 standard edition. Its actually using ODBC COnnector 5.1 to connect the DB in a linux machine.
When ever tried to open the DB the whole application crashed. returning Assertion failed: !"Driver bug: SQLGetDiagRec".

Is there any OS dependency in using ODBC connector.?
The same scenario works correctly in a windows 2008 R2 data center machine.

Regards,
Suku PK
Reply all
Reply to author
Forward
0 new messages