Bug #57240 Using SqlDriverConnectW in C++ builder returns ODBC Driver Manager error
Submitted: 5 Oct 2010 7:11 Modified: 8 Oct 2010 8:50
Reporter: Len La sala Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.1 OS:Windows (XP, Vista)
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: ODBC, vista, windows, XP

[5 Oct 2010 7:11] Len La sala
Description:
When using SqlDriverConnectW for a DSN Less connection ODBC Driver Manager reports "Data source name not found and no default driver specified" connection string parameter (_connectionString) follows this example "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;"

ret = SQLDriverConnectW(q->hdbc, NULL, 
(SQLWCHAR*)_connectionString.c_str(), SQL_NTS, (SQLWCHAR*)outstr, sizeof(outstr) / sizeof(SQLWCHAR),&outstrlen, SQL_DRIVER_NOPROMPT);

is this a bug!

How to repeat:
I do not know if this can be repeated else where
[5 Oct 2010 7:13] Len La sala
Language, C++ Builder
[8 Oct 2010 7:41] Bogdan Degtyariov
Hi Len,

First of all, the driver manager problem similar to this is not the driver problem because the driver is not even loaded yet (SQLDriverConnectW failed).
Consequently, we should take a closer look into the system settings.

You have submitted the bug report as for Connector/ODBC 5.1, but your connection string references ODBC driver version 3.51, which most probably is not installed in your system:

Driver={MySQL ODBC 3.51 Driver}

Please change it to "Driver={MySQL ODBC 5.1 Driver}" to fix the problem.
For now I am setting the status "Not a bug". You are more than welcome to provide more details if the problem still occurs.
Thanks.
[8 Oct 2010 8:50] Len La sala
Hi Bogdan,

Thanks for the extra pair of eyes, that fixed the problem, did not see that I was using 3.51 instead of 5.1, I will make sure that I get the actual installed version of the installed driver.
[8 Oct 2010 9:05] Bogdan Degtyariov
Hi Len,

Thank you for your feedback.
I am glad to hear that the problem has been fixed.
Thanks.