Solved

ASP MySQL ODBC Connection not working on Windows Server 2008 64bit

Posted on 2010-08-29
12
1,172 Views
Last Modified: 2012-05-10
Hi guys,

I'm moving websites from an old server to a new one, and I've hit a snag. One of our client websites is ASP based and uses a MySQL database. However, it simply refuses to connect to the database and throws up this error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


The code I'm using to call it is this:

Set contentConnect = Server.CreateObject("ADODB.Connection")
contentConnect.mode = 3 ' adModeReadWrite
contentConnect.open "Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Option=16387; Port=3306; Database=databasename; Uid=Username; Pwd=password;"


I've also tried this:

Dim sConnection, objConn , objRS, constring, baseurl, uploadpath
ConString = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost; DATABASE=Databasename; UID=Username;PASSWORD=Password; OPTION=3"


I've checked both the 32 and 64bit ODBC connectors and it exists in both instances. The name in the code matches the driver name in ODBC.

I've removed and re-installed the 5.1 ODBC driver

I've tried turning off 32bit applications in the App pool.

I've tried banging my head on the desk.

I've looked through the solutions on here but can't get any of them to work.

Any help would be very much appreciated!
0
Comment
Question by:Acteon
  • 6
  • 4
  • 2
12 Comments
 
LVL 8

Expert Comment

by:jessmca
Comment Utility
Unless you have also copied the MySQL database to the new server it wont be local host in the connection string but should be the IP address of the previoius computer running MySQL
0
 

Author Comment

by:Acteon
Comment Utility
I have copied the database across, I also tried replacing localhost with the old IP, but received the same error unfortunately.

I'm pretty certain it's the ODBC connection that's failing.

Thanks for the speedy response though!
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
You need to make sure the 'mysqld' daemon is listening on port 3306.  You can use Sysinternals TCPView to check that.  Here's a page I use to check my connection strings although it does match what you posted.  Did you make sure the local MySQL database had the appropriate usernames and passwords when you transferred over from the other machine?  Is it still running on the old machine?
0
 

Author Comment

by:Acteon
Comment Utility
It's still running on the old machine, and MySQL works for php-based connections (we have a few vBulletin forums already on there).

It only affects ASP sites using ODBC... The username/password has also been copied and no dice...
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
For what it's worth, here's the ASP code I use that works on Godaddy IIS7 and on Win2k IIS5.  I'm connecting to a remote MySQL in both cases.  And the same code works with 'localhost' on WinXP IIS5.1 where the MySQL server is here.  It uses an earlier version of the MySQL ODBC connector but that's the only difference I can see except for the 'mode 3'.
' Create ADO Connection Component to connect to database

connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

Open in new window

0
 
LVL 8

Accepted Solution

by:
jessmca earned 250 total points
Comment Utility
Make sure to use a system DSN, if it is a user DSN then make sure the userif in your connection string has suitable permissions to access it or you will get that same error
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Acteon
Comment Utility
http://bugs.mysql.com/bug.php?id=56233

This appears to be a bug with MySQL itself, has anyone else encountered this? And is there a way to connect with ASP without using DSN or ODBC? (Have to admit I haven't found one and it kinda defeates the object, but I'm looking for a workaround now...)
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
Comment Utility
If you read to the end of that article, one user said he was able to remove 5.1.7 and install 5.1.6 and have it work.
0
 

Author Comment

by:Acteon
Comment Utility
I was using 5.1.6 with the same error and tried 5.1.7 before reading that article - same issue with both versions sadly.

I suppose I could try version 5.1.5 if I can find it. I'm pretty annoyed that MySQL would release any version with a bug this major.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
The 3.51 version is still available for x86 64-bit on this page: http://www.mysql.com/downloads/connector/odbc/3.51.html#downloads
0
 

Author Comment

by:Acteon
Comment Utility
I managed to get it working with 5.1.6 after numerous reboots and much swearing.

Since everyone helped I'm going to try to apportion points evenly.
0
 

Author Closing Comment

by:Acteon
Comment Utility
Basically go back to version 5.61 and reboot a few times to ensure the new settings take effect.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now