Solved

Getting server create object failed when setting MySQL ODBC connection

Posted on 2014-09-10
10
1,398 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
  • 5
  • 4
10 Comments
 
LVL 32

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 32

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
 
LVL 52

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 32

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 32

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

13 Experts available now in Live!

Get 1:1 Help Now