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.
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.