MySQL ODBC Issue: Data source name not found and n

2019-06-07 13:18发布

问题:

I'm currently trying to run a classic ASP application which I've been given source code for. I want to set up on my 64bit Windows 7 dev machine and am having trouble with an ODBC based data connection to a MySQL instance.

I'm seeing the error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

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

/includes/<File Name>.asp, line 100

What I've tried:

  • The connection is DSN-less.
  • The application is running under IIS app pool with local system permissions. w3wp.exe can be seen running under NT AUTHORITY/SYSTEM in process monitor.
  • The application is running under IIS app pool with 32 bit applications allowed to run.
  • Have tried with Connector/ODBC 5.1.10 64 bit version only installed from http://dev.mysql.com (At this point no driver was listed under C:\Windows\SysWOW64\odbcad32.exe but was under C:\Windows\system32\odbcad32.exe)
  • Have tried with Connector/ODBC 5.1.10 32 bit version only installed from http://dev.mysql.com (At this point no driver was listed under C:\Windows\system32\odbcad32.exe but was under C:\Windows\SysWOW64\odbcad32.exe)
  • Have tried with Connector/ODBC 5.1.10 32 bit and 64 bit versions installed.
  • Verified driver name is not misspelled. Along with other checks from here http://support.microsoft.com/kb/306345.

    Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=DBName;User=root;Password=Password;Option=3

Additional Information:

I'm monitoring in process monitor, and the two results are:

PATH NOT FOUND (Looking for .asp/web.config which seems odd. BUFFER OVERFLOW

Both entries show:

User: NT AUTHORITY\SYSTEM

Process: C:\Windows\SysWOW64\inetsrv\w3wp.exe C:\Windows\SysWOW64\odbcint.dll

I'm stumped can any one make a suggestion on how I get this running in the context I have described?

回答1:

Solved the problem now. Recording here in case this of use to others.

The issue was much simpler than it first appeared. The problem was that the application used a mixture of named and unnamed datasources (DSN / DSN-Less).

It was not apparent to me that any named connections were used until I set up the application for debugging in Visual studio. Here is a rough guide to debugging the application in visual studio (Except I used HTTP based website, rather than file system):

http://www.codeproject.com/Articles/28792/Debugging-Classic-ASP-VBScript-in-Visual-Studio-20

Following creating the required DSN, there were some further exceptions being thrown regarding default values in database columns. This was due to a MySQL setting that can be changed in the my.ini file.

http://bugs.mysql.com/bug.php?id=14306

C:\Program Files (x86)\MySQL\MySQL Server 5.5\my.ini

# Set the SQL mode to strict
# sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
sql-mode=""


回答2:

I found this to work from Windows to MySQL as a DSN-less connection. The trick was to ELIMINATE the port spec at the end of the server address.

"DRIVER={MySQL ODBC 5.3 UNICODE Driver}; Server=**;Database=**;User=**;Password=**; OPTION=3"

Note: Server string is the internet address of the server, BUT NO PORT SPECIFIED - ie, NO ":3306" on the end