Bug #41867 SQLConfigDataSource for MySQL ODBC 5.1 Driver returns 'Cannot find driver'
Submitted: 5 Jan 2009 14:01 Modified: 13 Jan 2009 11:52
Reporter: Sonya Karpishpan Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1 OS:Windows
Assigned to: CPU Architecture:Any
Tags: 5.1, Cannot find driver, SQLConfigDataSource

[5 Jan 2009 14:01] Sonya Karpishpan
Description:
I am creating an ODBC DSN programmatically from c#.

How to repeat:
 the following code works fine with Driver 3.51 but returns an error 'Cannot find driver' for 5.1:

    String strAttributes = "DSN=" + asDSNName + "\0";
            strAttributes = strAttributes + "Server=" + asServerName + "\0";
            strAttributes = strAttributes + "Database=" + asDBName + "\0";
            strAttributes = strAttributes + "Trusted_Connection=No" + "\0";
            strAttributes = strAttributes + "Uid=" + asUserName + "\0pwd=" + asPassword + "\0";
            
            
            success = SQLConfigDataSource((IntPtr)0, ODBC_ADD_DSN, asDriver, strAttributes);

Can you please help?
[5 Jan 2009 14:05] Sonya Karpishpan
my parameter values at runtime are:

asDriver = "MySQL ODBC 5.1 Driver"	

strAttributes is =	"DSN=SonyaTestLocal\0Server=localhost\0Database=SonyaTest\0Trusted_Connection=No\0Uid=root\0pwd=\0"
[6 Jan 2009 13:49] MySQL Verification Team
Thank you for the bug report. Which exactly Windows version are you using?. Thanks in advance.
[6 Jan 2009 15:09] Sonya Karpishpan
I am using Windows XP.
[13 Jan 2009 11:52] Tonci Grgin
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Explanation: Hi Sonya. This report is a duplicate of Bug#41796.
[31 May 2011 20:42] Erdem Demirel
Thank you....
[26 Feb 2012 15:35] karto polo
i have succes full with this
    strAttributes = "DSN=SonyaTestLocal1" & Chr$(0) & ";" & "Server=localhost" & Chr$(0) & ";" & "Database=mylab" & Chr$(0) & ";" & "Uid=root" & Chr$(0) & ";" & "pwd=" & Chr$(0) & ";"
[1 Aug 2012 3:11] wu fenpeng
MySQL ODBC 5.1 Driver use the char ';' in attributes string instead of the '\0'