SQLDriverConnect - FileDSN
How can I connect to a database using File DSN? I have to use only SDK[that's my requirement].
I tried using 'SQLDriverConnect', but couldn't do that as it's returning an error and the SQLSTATE of the error is HY024.
Can any one point me to some example...
kiran.
Re: SQLDriverConnect - FileDSN
Use SQLGetDiagRec() to retrieve error message that may be more helpful.
Re: SQLDriverConnect - FileDSN
I have already used SQLGetDiagRec() and the got error message which i posted in my previous post. This issue is solved. But i got another one, the error status is 'IM006',which I believe is caused if the database driver's SQLSetConnectAttr function call fails during a SQLConnect or a SQLDriverConnect function call.
But how do i work around this problem?
Or
Is my code wrong?
Re: SQLDriverConnect - FileDSN
Here may be some useful information.
Why do I see the following messages in the Output window for the Visual Workbench when CDatabase::Open() or CRecordset::Open() is called?
Warning: ODBC Success With Info, Driver's SQLSetConnectOption failed
State:IM006,Native:0,Origin:[Microsoft][ODBC DLL]
Driver not capable.
State:IM006,Native:0,Origin:[Microsoft][ODBC DLL]
State:S1C00,Native:0,Origin:[Microsoft][ODBC Single-Tier Driver]
The TRACE() messages shown above occur only if MFC DB Tracing is enabled.
The CDatabase::AllocConnect() function, located in DBCORE.CPP of the MFC sources, contains the following line of code:
AFX_SQL_SYNC(::SQLSetConnectOption(m_hdbc, SQL_LOGIN_TIMEOUT,
m_dwLoginTimeout));
Because ODBC does not provide a way to determine whether or not an ODBC driver uses a "login time-out," the database classes always try to set this option before trying to connect. If SQLDriverConnect() is called and the driver does not support login time-outs, the above ODBC warning messages will occur.
These are harmless warnings (that is, connecting was successful) and can be ignored. When you see the warnings, keep in mind that the login time-out has no affect on the data source.