SYMPTOMS
After using SQLSetConnectOption to set SQL_CURRENT_QUALIFIER to a valid
data source path, the following SQLConnect (or SQLDriverConnect) will
return SQLSetConnectOption failure message, and a connection is established
without current qualifier set to that desired path.
NOTE: It occurs with all the desktop database drivers.
For example, in case of Microsoft Access driver, do the following:
SQLAllocConnect(henv, &hdbc);
SQLSetConnectOption(
hdbc, SQL_CURRENT_QUALIFIER, "C:\ODBC20\SMPLDATA\ACCESS\SAMPLE"
); //Note: It's a valid path
SQLConnect(
hdbc, "sdk21-Access", SQL_NTS, "admin", SQL_NTS, NULL, 0
); //Note: DSN points to "C:\ODBCSDK\SMPLDATA\ACCESS\SAMPLE"
You will get:
SQL_SUCCESS_WITH_INFO,
IM006, "[Microsoft][ODBC DLL] Driver's SQLSetConnectOption failed"
08003, "[Microsoft][ODBC Driver pack 2.0 Driver]Connection is not open"
The 08003 is misleading. Actually, the connection to sdk21-Access has been
established with the current qualifier set to
C:\ODBCSDK\SMPLDATA\ACCESS\SAMPLE.