Solved

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

Posted on 2010-08-29
12
1,182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
12 Comments
 
LVL 8

Expert Comment

by:jessmca
ID: 33552561
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
ID: 33552575
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 83

Expert Comment

by:Dave Baldwin
ID: 33553948
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Acteon
ID: 33554065
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 83

Expert Comment

by:Dave Baldwin
ID: 33554167
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
ID: 33554193
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
 

Author Comment

by:Acteon
ID: 33591645
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 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 33592042
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
ID: 33592213
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 83

Expert Comment

by:Dave Baldwin
ID: 33592643
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
ID: 33691115
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
ID: 33691141
Basically go back to version 5.61 and reboot a few times to ensure the new settings take effect.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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