Bug #41796 SQLConfigDataSource failed: Cannot find driver
Submitted: 30 Dec 2008 15:00 Modified: 8 Apr 2013 5:32
Reporter: Anton Serbulov Email Updates:
Status: Duplicate Impact on me:
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1.5,5.1.8 OS:Microsoft Windows
Assigned to: Assigned Account CPU Architecture:Any
Tags: SQLConfigDataSource failed: Cannot find driver

[30 Dec 2008 15:00] Anton Serbulov
1. Install mysql-connector-odbc-5.1.5-win32.msi on Windows w2k3/w2k8 (x86/x86)
2. Add System DNS via SQLConfigDataSource
3. Result: 
Cannot find driver
Cannot find driver
Driver's ConfigDSN, ConfigDriver, or ConfigTranslator failed

How to repeat:
#include "stdafx.h"
#include "windows.h"
#include "odbcinst.h"
#include <iostream>

int _tmain(int argc, _TCHAR* argv[])
	#define countof(array)	(sizeof(array) / sizeof(array[0]))
	if (!SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN, 
		_T("MySQL ODBC 5.1 Driver"), 
		std::wstring m_errStr;

		for(WORD i = 1; i <= 8; ++i){
           DWORD errorCode;
           TCHAR errorMsg[SQL_MAX_MESSAGE_LENGTH];
           RETCODE ret = SQLInstallerError(i, &errorCode, errorMsg, (WORD)countof(errorMsg), NULL);
           if(ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO){
                 m_errStr += _T('\n');
               m_errStr += errorMsg;
		std::wcout << m_errStr.c_str() << std::endl;
	return 0;

Suggested fix:
--- C:/mysql-connector-odbc-5.1.5r1144/util/installer.c	Sat Aug 09 00:07:56 2008
+++ C:/mysql-connector-odbc-5.1.5r1144/util/installer.c	Tue Dec 30 19:35:41 2008
@@ -999,7 +999,7 @@
   /* Get the actual driver info (not just name) */
   driver= driver_new();
-  memcpy(driver->name, ds->driver,
+  memcpy(driver->lib, ds->driver,
          (sqlwcharlen(ds->driver) + 1) * sizeof(SQLWCHAR));
   if (driver_lookup(driver))
[30 Dec 2008 15:02] Anton Serbulov

1. Install mysql-connector-odbc-5.1.5-win32.msi on Windows w2k3/w2k8 (x86/x64)
[8 Jan 2009 16:15] Jess Balint
Anton, Thanks for your bug report. Is the application you've compiled a 32 or 64 bit application?
[9 Jan 2009 4:00] Anton Serbulov
32-bit application
[13 Jan 2009 11:53] Tonci Grgin
Bug#41867 was marked as duplicate of this report.
[16 Jan 2009 17:25] Mike Beirens

I have the same problems, creating it with Setup Factory and VB6
With 3.51 it is working.
Allow me to define what I think the problem may be.
The DLL isn't in system32 directory anymore, but in the Program Files\MySql... what is not a defaultpath in windows.

[28 Jan 2009 13:48] Roberto Farioli
We have the same error with MYSQL ODBC 5.1
[28 Jan 2009 20:01] Tonci Grgin
Hi Anton and thanks for your report.

We have tested and discussed it but I won't go into details now. This appears to be the genuine problem, at least on my W2K8 server x64 box.

So, verified as described.
[29 Jan 2009 21:32] Jess Balint
Problem was, driver lib was passed to ds_add(), which is normally set back to the name in ShowOdbcParamsDialog().

=== modified file 'setupgui/ConfigDSN.c'
--- setupgui/ConfigDSN.c        2008-03-18 02:12:19 +0000
+++ setupgui/ConfigDSN.c        2009-01-29 21:29:08 +0000
@@ -116,7 +116,22 @@
       rc= FALSE;
-    ds_set_strattr(&ds->driver, driver->lib);
+    if (hWnd)
+    {
+        /*
+          hWnd means we will at least try to prompt, at which point
+          the driver lib will be replaced by the name
+        */
+        ds_set_strattr(&ds->driver, driver->lib);
+    }
+    else
+    {
+        /*
+          no nWnd is a likely a call from an app, no prompting so
+          we put the driver name already
+        */
+        ds_set_strattr(&ds->driver, driver->name);
+    }
 #ifdef _WIN32
[29 Jan 2009 22:33] Jess Balint
Duplicate of bug#33825
[4 Mar 2009 7:16] Tonci Grgin
Bug#43350 was marked as duplicate of this report.
[4 Mar 2009 7:21] Tonci Grgin
Jess, I don't see the patch in main dev tree. Where is it pushed to and in which revision?
[5 Apr 2009 1:53] Muhammad Anjum
I am just new to MySQL and I am facing the same problem. how can I get the patch for this. Please guide.thanks.
[13 Apr 2009 17:21] Osvaldo Miatello
There is any news about this Bug?
I'm trying to create from VB 6.0 a DSN, see this http://support.microsoft.com/kb/171146 

It works perfectly if replace:

strDriver = "SQL Server" into this strDriver = "MySQL ODBC 3.51 Driver"

But it doesn't works when i try the 5.1 ODBC Driver:
strDriver = "MySQL ODBC 5.1 Driver"

Any one can Help?

[20 May 2009 16:51] Jess Balint
Pushed as rev 832, will be released in 5.1.6.
[27 Jul 2009 9:21] Dennis G
Related post http://forums.mysql.com/read.php?37,271033,271033#msg-271033

I am using Version 5.1.6r828_20090319_0836-win32 and I get the Driver not found error on ONE machine, whereas not on the other machine. Only obvious difference between the two is English XP on the working machine, German XP on the not-working one.
Code used was custom, but can be replicated with the Microsoft sample code with the link posted previously (kb171146)

Switching back to 3.51 makes the code work on all machines. I'm available for any inquiries concerning the differences of the two machines.
[3 Aug 2009 7:03] Bogdan Degtyariov
Hi Dennis,

Can you please check the following REG_SZ values in the registry of both English and German versions of WinXP:


[3 Aug 2009 10:49] Dennis G
Interesting differences there:
First Working reg on English XP:

C:\Program Files\MySQL\Connector ODBC 5.1\myodbc5.dll
C:\Program Files\MySQL\Connector ODBC 5.1\myodbc5.dll
C:\Program Files\MySQL\Connector ODBC 5.1\myodbc5S.dll

now the not working reg on German XP:
--does not apply-- as Access reports Driver not found I cannot create the DSN - 
a manual creation via ODBC interface leads to correct "C:\windows\system32\myodbc5.dll" otherwise it is C:\windows\system32\myodbc3.dll for the 3.51 driver

I notice only one point:
On the one machine the MySQL ODBC Connector was installed to Program Files on the other Machine to system32. Funnily teh driver cannot be found when installed in system32. I could try reinstalling all the drivers, but still want to report my findings.
[6 Aug 2009 16:28] Jess Balint
Can you try again using at least rev 832? I just checked the snapshots which are at 835. You can download a copy here:

[5 Aug 2010 15:52] Rocco Melzian
Bug seems to be solved with version 5.1.6
[30 Aug 2010 17:48] Lawrenty Novitsky
I've run into similar problem. SQLConfigDataSource(NULL, ODBC_CONFIG_DSN, ...) simply deletes existing DSN.
Re-opening the bug.
[6 Oct 2010 10:53] sh ds
when u trying to install mysql odbc drivers check the os 32 bit or 64 bit os 

after that u install depends on os u install 32 bit r 64 bit drivers u install  this is the cause 
mysql dba
[17 Dec 2010 7:14] Tonci Grgin
Bug#58796 was marked as a duplicate of this report.

[17 Dec 2010 9:35] Bogdan Degtyariov
Version 5.1.8 does not delete the DSN, but all fields are empty
[8 Apr 2013 5:32] Bogdan Degtyariov
The bug fix is posted for bug 66548.
Marking this report as Duplicate of 66548.