Solved

Getting server create object failed when setting MySQL ODBC connection

Posted on 2014-09-10
10
1,496 Views
Last Modified: 2014-09-10
I am trying to setup an ODBC connection string in classic asp to a remote MySQL database and I keep getting the server.createobject failed error. I am running Windows 7 (64 bit) but IIS is set for 32 bit mode. I have installed latest MySQL ODBC connector driver (5.3.4) bot 32 and 64 bit versions. I am able to setup and test a system DSN connection to the remote MySQL database both from the control panel and from the odbad32.exe in the syswow64 folder so I know my credentials are correct. I can also connect using MySQL workbench with no problem. Here is an example of the connection string I am using. I have x'd out the server IP and login info for security reasons.  Something I am missing?

Dim mySQLConnect

Set mySQLConnect = Server.CreateObject("ADODB.Connection")
mySQLConnect.Open "DRIVER={MySQL ODBC 5.3 Unicode Driver}; SERVER=xx.xxx.xxx.xxx; PORT=65265; DATABASE=asteriskcdrdb; UID=xxxx;PASSWORD=xxxx; OPTION=3"
0
Comment
Question by:dssisupport
[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
  • 5
  • 4
10 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 40314967
sounds like a permissions issue or even your mdac being corrupted. try re-installing the mdac package, which you can download from here:

http://www.microsoft.com/en-us/download/details.aspx?id=5793

some more info on the mdac:

http://msdn.microsoft.com/en-us/library/ms810805.aspx
0
 

Author Comment

by:dssisupport
ID: 40315019
Thanks for the quick response but I don't think MDAC is the problem because I also have a connection string to a local SQL express server that works perfectly. In this scenario I need to open two connection strings, One to my local SQL express server and one to the remote MySQL server. The local connection works just fine. If it was a permission issue I would assume that my DSN connection test would fail and MySQL workbench is also using the same connection info and credentials.
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40315025
if you're getting a Server.CreateObject failed error message (as indicated by your title), then it's most likely what I suggested above. If you're getting a different error message, please post EXACTLY what that message is
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 40315055
Take a look at the connection string options  http://www.connectionstrings.com/mysql-connector-odbc-5-2/

Driver={MySQL ODBC 5.2 ANSI Driver};Server=myServerAddress;Database=myDataBase;
User=myUsername;Password=myPassword;Option=3;

Driver={MySQL ODBC 5.2 ANSI Driver};Server=myServerAddress;Port=xxxx;
Database=myDataBase;User=myUsername;Password=myPassword;Option=3;

OLEDB
Server=myServerAddress;Port=xxxx;Database=myDataBase;Uid=myUsername;
Pwd=myPassword;
0
 

Author Comment

by:dssisupport
ID: 40315080
To Big_Monty: The link you provided for the MDAC is not for Windows 7 (64 bit) so that's not going to help. I don't think there is a direct download for the MDAC that is compatible with Windows 7. The exact error I am getting is ASP_0177_:_800401f3|Server.CreateObject_Failed.

To Scott: I had actually already went to that site to get the connection string and I have tried a few of them but all get the same error.
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 40315093
try the link below, it is for both 32 bit and 64 bit versions.

http://www.microsoft.com/en-us/download/details.aspx?id=21995

The error you're getting is not related to making an actual connection the database, but rather trying to access the DLL that Server.CreateObject uses. Usually re-installing the mdac resolves this issue, however if you're comfortable in the registry, you may look into this approach as well.
0
 

Author Comment

by:dssisupport
ID: 40315436
I will give it a shot but wouldn't that affect my SQL Server connection string as well?
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 40315443
no, not at all.

whenever you do a Server.CreateObject("xxx"), you're calling a dll that has been registered on the server. The connection string is a parameter you're passing to one of the functions within that object.
0
 

Author Comment

by:dssisupport
ID: 40315524
Ok, I installed the MDAC from the link but unfortunately still get the same error.
0
 

Author Comment

by:dssisupport
ID: 40315595
I am a complete moron... It wasn't the MySQL connection that was causing the error. There was another control further down in the page that didn't have it's dll registered correctly. It just seemed like it was the mysql because before I fixed the connection string I was getting another error so after I fixed the string then it was able to get past that code and then bomb. I apologize for the confusion but your statement about why the error was occurring did out me on the right track.

Thanks!
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

622 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