ODBC connection in new version mysql

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/70074?pagenum=1
05 November 2025, 10:42

Topic


sikandar
ODBC connection in new version mysql
17 January 2012, 02:17


hi all,
I have a challenge that on windows 2003 there was no challenge but now I am trying same setup on 2008 but getting error as now even mysql version is changed from 3.2 to 5 so kindly let me know what will be new connection method or string as getting following error,

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/forums/inc_header.asp, line 121

Thanks in advance.

 

Replies ...


Podge
19 January 2012, 09:30


Have you installed the ODBC connector for MySql? http://dev.mysql.com/downloads/connector/odbc

Are you on 64bit windows?
Davio
03 June 2012, 06:43


Originally posted by Podge
Have you installed the ODBC connector for MySql? http://dev.mysql.com/downloads/connector/odbc

Are you on 64bit windows?

I did install the latest drivers (5.1.11) and I am on 64bit windows 7. Got the same error as initial poster on the setup.asp page.
I had downloaded and installed the 64bit version of the odbc driver, but the mysql documentation had said the installer also installs both 32 bit and 64 bit versions.
Connection string being used:
strConnString = "driver={MySQL ODBC 5.1 Driver};option=16387;server=localhost;user=***;password=***;Database=snitz;"

Will keep searching for a solution, but if anyone have any ideas...
ruirib
03 June 2012, 09:04


Can you connect to the database through other means? Say, using SQLYog?
Davio
03 June 2012, 12:47


In fact, I created the database using SQLYog, and setup a database user just for the forum using SQLYog. So that is an affirmative.
I use MySQL Workbench to manage (start/stop) the server.
ruirib
03 June 2012, 13:13


If you try to create an ODBC data source, are the drivers listed there?
Also, if you ping localhost, do you get a reply? Have you tried using the IP instead - am just trying to rule out any networking issues from this. I think I had to add an entry for localhost in my hosts file when I started using IIS on my Windows 7 x64.
Davio
03 June 2012, 15:26


Yeah, the driver is listed. Made sure to check before and after I installed them. Under the driver tab:
Name: MySQL ODBC 5.1 Driver
Version: 5.01.11.00
Company: Oracle Corporation
File: MYODBC5.DLL
Date: 4/28/2012

Took a try at creating a user DSN connection, using MySQL ODBC drivers. Tested the connection on the DSN creation window and it tested ok. Saved it. Edited config.asp. And tried setup.asp again and same error.
Have you tried using the IP instead
I tried 127.0.0.1 as the server ip address and still got the same error. Tried it with the DSN as well, same error.
I'll check my host file in a few mins and get back to you.
Davio
03 June 2012, 16:17


Ok, I think I am getting somewhere here.
Referred to this MS article on the error:
http://support.microsoft.com/kb/306345

It seems it is a permissions problem, that the IIS anonymous account doesn't have permissions to access the registry that contains the information about the specific ODBC driver.
I granted the registry key (which is a subkey under HKLM\SOFTWARE\ODBC\ODBCINST.INI), READ permission for the IUSR account, and ran setup.asp again. Now I have this error:
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
From my search it seems I am using a 64bit driver with my 32bit application pool.
Looks like I will need to uninstall the 64 bit mysql driver and install the 32 bit.
Will see how that works out.
ruirib
03 June 2012, 16:43


Do not connect through DSN. There is no need to do that. Just use the DNSless Snitz connection string.
I am pretty sure I didn't need to do anything regarding the registry, but I did start with the 3.51 driver.
Davio
03 June 2012, 16:48


Uninstalled the 64bit version and installed the 32bit version of MySQL Connector/ODBC drivers. The driver did NOT show up in the ODBC Data Source Administrator list of drivers, like the previous 64bit driver did. Not sure why. Maybe it only lists 64bit drivers?
But it works now using the DSN-less connection string. strConnString = "driver={MySQL ODBC 5.1 Driver};option=16387;server=127.0.0.1;user=***;password=***;Database=snitz;"

Setup went fine. Tables created without errors.
I'll try creating a DSN connection using the myodbc-installer.exe command line utility next time. (In the same folder as where the myodbc drivers are)
ruirib
03 June 2012, 16:59


You don't need the 32 bit drivers. I am using the 64 bit and it works fine.
Davio
03 June 2012, 17:02


Well rui, if you have other suggestions you want me to try with the 64bit version of the driver, I'll try it. I'll uninstall the 32bit and reinstall the 64bit.
ruirib
03 June 2012, 17:05


Had you tried the DSNless connection after that registry thing?
Have you tried installing the 3.51 driver?
Davio
03 June 2012, 17:15


Reinstalled the 64bit. Dropped the "snitz" database and created an empty 1.
Gave the subkey "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 5.1 Driver" READ permission for the IUSR account and ran setup again.
Same error: "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
Will download and try the 3.51 driver. But isn't the latest version based on the 3.51? At least, it's what I read in the docs.
ruirib
03 June 2012, 17:32


Weird, man, very weird. I started with 3.51 and still use in some places. Earlier versions of the 5.1 were not that reliable.
Davio
03 June 2012, 17:44


I installed the 64 bit version of the 3.51 driver (Custom Install gave the option to install both 32bit and 64bit. Made sure that 32bit was unselected), using the following connection string:
Code:
strConnString = "driver={MySQL ODBC 3.51 Driver};option=16387;server=localhost;user=***;password=***;DATABASE=snitz;" '## MySQL w/ MyODBC v3.51
Got the same error again.
Gave READ permission to the subkey "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver" for the IUSR account and ran setup again. Same error again.
Uninstalled the 64bit 3.51 driver, installed the 32bit version of it, and ran setup.asp and it works.
Seems to be the 32bit version works in both cases. Probably because it is a 32bit app we are using?
ruirib
03 June 2012, 17:46


What 32 bit app are you using?
Davio
03 June 2012, 17:48


I was referring to the 32bit application pool that we enabled in IIS. smile
ruirib
03 June 2012, 17:52


You enabled the pool to work with 32 bit apps (which works for Access), but that was it. It's still a 64 bit IIS. I have a pretty similar config and I had no issues whatsoever.
Davio
03 June 2012, 17:59


So you're sure you have the 64bit version of the driver using?
To check, the 32bit versions are installed in:
C:\Program Files (x86)\MySQL\Connector ODBC 5.1
C:\Program Files (x86)\MySQL\Connector ODBC 3.51

And the 64bit version in:
C:\Program Files\MySQL\Connector ODBC 5.1
C:\Program Files\MySQL\Connector ODBC 3.51

by default.
You have to make sure the 32bit version is not installed, to ensure it is the 64bit version you are using. If the drivers are listed in the folders for the 32bit, then you have the 32bit installed as well, and most likely using the 32bit.
Let me know.
ruirib
03 June 2012, 18:05


I have had the 64 bit version installed right from the beginning of my usage of Windows 7 (almost 3 years now). I recently upgraded the 5.1 driver (9 May) and it seems the 32 bit version was installed too. I still have a few local test forums running under 3.51, of which I have only the 64 bit version.
Davio
03 June 2012, 18:12


Well I'm stumped on it as well. Will keep searching and see if anything comes up that could help.
EDIT: Just a small tip, realized there are 2 versions of the ODBC Data Source Administrator. The 64bit and the 32bit. The 64bit is located here: C:\WINDOWS\System32\odbcad32.exe
The 32bit is located here: C:\WINDOWS\SysWOW64\odbcad32.exe

The 32bit drivers showed up in the 32bit version of the ODBC Data Source Admin. That's why I didn't see them listed in the 64bit version.
ruirib
03 June 2012, 18:14


David, if 32 bit works for you, don't waste any more time, I'd say. It doesn't affect anything you do. As long as you have a working solution...
Davio
03 June 2012, 18:20


Originally posted by ruirib
David, if 32 bit works for you, don't waste any more time, I'd say. It doesn't affect anything you do. As long as you have a working solution...
I was more doing it for debugging purposes, for anyone else who might have a similar problem in the near future. smile But yeah, I guess I can leave it there for now.
Davio
03 June 2012, 19:02


Sorry Rui, I can't help it. I couldn't put this one down, as the debugging part of me wouldn't rest. tongue
The error using a system dsn with the 64bit drivers had given me this error:
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
This error means, either the driver is 64bit and the app is 32bit, or vice versa.
Since I know I installed the 64bit driver, I checked my Task Manager to see if IIS was a 32bit or 64bit process. And I notice, the DefaultAppPool is running as a 32bit process.
See screenshot: http://img41.imageshack.us/img41/6352/iisv.jpg

So the 32bit app is accessing the 64bit DSN connection which can't work. (still doesn't explain how you got it working. ah well.)

Anyways, leaving this alone again. lol
ruirib
03 June 2012, 19:16


Then I should get the same and I don't. My Process Explorer does not show me that info for w3wp, funnily enough.
Did you install the 64 bit version of MySQL?
ruirib
03 June 2012, 19:19


I just set Enable 32 bit apps in my IIS to false and ran one of my local Snitz forums. No issues whatsoever. You only need the 32 bit setting if you use Access, which there is hardly any need, at least on my case.
You can try this too.
Davio
03 June 2012, 19:44


lol that works rui. I had set the 32bit setting when I was testing with Access. Thought that meant I needed this setting set to true to run classic asp.
The defaultapppool is now running in 64bit mode and using the 64bit myodbc drivers with the dsn-less connection string.
ruirib
03 June 2012, 19:53


No, had you started with MySQL and I wouldn't have advised the 32 bit thing. The puzzling bit is that things work for me one way or the other.
Davio
03 June 2012, 20:00


Well, you can set the 32bit setting per site. So for your site using Access, you can turn it on and for your site using MySQL, you can turn it off. Would make sense if you have it that way.
ruirib
03 June 2012, 20:41


I had it as a general setting, actually. That's why I find this weird.
Anyway, you're all set now, so no need to keep worrying about this :):
robbieh
13 July 2012, 16:53


I'm having similar issues. If I try DSN, I get the following:
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

If I try the 'strConnString = "driver={MySQL ODBC 3.51 Driver I get this
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

If I try 'strConnString = “driver={MySQL ODBC 5.1 Driver} I get an IIS 500 error.
I've tried changing the application pool to 32 bit, no luck. I've tried both ODBC drivers as well.
I'm giving up trying to get the Access database working on Windows Server 2008 R2 and want to get MySQL working.
ruirib
13 July 2012, 17:35


Are you using a classic app pool?
© 2000-2021 Snitz™ Communications