Solved

Getting server create object failed when setting MySQL ODBC connection

Posted on 2014-09-10
10
1,463 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS SQL + date 6 54
ASP AND XML 3 42
Table doesn't show the lines! 3 36
SP inserts data with order number, then push the rest one order up 11 44
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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
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…

751 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