Can’t connect to MySQL with ASP

I’m trying to connect to MySQL on my local computer with ASP on my website. I get this error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on '********.dyndns.org' (10060)
/******.asp, line 17


Here is my ASP code:

<%
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server

db_server = "*******.dyndns.org" 'db_server = "mysql.secureserver.net"
db_name = "******" 'db_name = "your_dbname"
db_username = "*****" 'db_username = "your_dbusername"
db_userpassword = "*****" 'db_userpassword = "your_dbpassword"
fieldname = "your_field" 'fieldname = "your_field"
tablename = "your_table" 'tablename = "your_table"

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

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

'qry = "SELECT * FROM " & tablename

'Set oRS = oConn.Execute(qry)

'if not oRS.EOF then
'while not oRS.EOF
'response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "<br>"
'oRS.movenext
'wend
'oRS.close
'end if

'Set oRs = nothing
Set oConn = nothing

%>



My website is hosted on a Windows server through GoDaddy.com
MySQL version: 4.0.26

I’m able to connect remotely to MySQL; I’ve done it with MySQLAdministrator, I just can’t do it with the ASP code.
stevecaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kevp75Commented:
just to verify... when using the MySQLAdministrator are you connecting to the database via *******.dyndns.org?

some other thing to try are:
<%
    cst = "Provider=MySQLProv;" & _
        "Data Source=<x.x.x.x>;" & _
        "Database=<dbname>;" & _
        "User Id=<uid>;" & _
        "Password=<pwd>"
%>

or

<%
    cst = "Driver={MySQL};" & _  
        "Server=<x.x.x.x>;" & _
        "Database=<dbname>;" & _
        "Uid=<uid>;" & _
        "Pwd=<pwd>"
 %>

or

<%
    cst = "Driver={MySQL ODBC 3.51 Driver};" & _
        "Server=<x.x.x.x>;" & _
        "Database=<dbname>;" & _
        "Uid=<uid>;" & _
        "Pwd=<pwd>;"
%>


please make sure to replace the necesary info
0
kevp75Commented:
also.  Another thing to try would be to use the IP address instead of the dyndns.org address

p.s.  Since you are hosting through GoDaddy, I am assuming you have your domain name registered there?  If this is the case why in the name of all that is good would you use dyndns.org?  You could simply setup a CNAME, or A record to point to the MySQL server....
0
fuzzboxerCommented:
If it is on your local machine, you should use localhost.

db_server=localhost;
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

fuzzboxerCommented:
You may need to specify the port number in your connection string.
0
stevecaAuthor Commented:
kevp75,

Yes, when I used MySQLAdministrator to connect I also used the server address *******.dyndns.org.

The MySQL database is located on a computer in my home. The *******.dyndns.org allows me a consistent address if my IP address changes.

I’m trying to write ASP code that will sit on the GoDaddy server, as part of my website there. The ASP code will reach out to my computer here and get information from the MySQL database to be used in the creation of content on my website.
0
stevecaAuthor Commented:
fuzzboxer,

I've tried appending the port number to the server address, but it didn't work either.
0
stevecaAuthor Commented:
Here is the error message I get when I append the port number:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[MySQL][ODBC 3.51 Driver]Unknown MySQL server host '*********:3306' (11004)
/*****.asp, line 17
0
fuzzboxerCommented:
Hmm, could be a syntax error.  Try this:  connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=db_server;DATABASE=db_name;UID=db_username;PASSWORD=db_userpassword;"
0
stevecaAuthor Commented:
I've tried with the comma at the end and with PWD or PASSWORD. These all give the same original error.

Of the three variation that kevp75 suggested, the first gave this error:

ADODB.Connection error '800a0e7a'
Provider cannot be found. It may not be properly installed.
/********.asp, line 17

The second variation gave 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
/******.asp, line 17

And the third gave the original error message.
0
fuzzboxerCommented:
Add OPTION=3; after the password and try again.
0
stevecaAuthor Commented:
same error still
0
kevp75Commented:
ok.  That means godaddy does not have the drivers installed to connect to a mySQL database.  Your only other options are

A)use MS Access
b)use a different database that they support
0
fuzzboxerCommented:
I found this article on their help section:  http://help.godaddy.com/article.php?article_id=260

Give that a shot.
0
rdivilbissCommented:
That would only help if he had a file DSN on goDaddy.
0
fuzzboxerCommented:
According to godaddy.com, you have a specific directory for File DSNs called "_dsn".
0
stevecaAuthor Commented:
kevp75,

GoDaddy does have drivers installed. It is possible to set up a MySQL database on their server and connect to that. The issue is that I want to connect to a database on my home computer, not on the website server.
0
stevecaAuthor Commented:
From what I am gathering as I look on various forums, GoDaddy has some kind of firewall in place. Apparently it is possible to work around it using their proxy server, but the GoDaddy help desk doesn't support it at all. Here's a link to what I've found out: http://www.spacialaudio.com/forums/viewtopic.php?t=14731

Any clues where to go from here?
0
rdivilbissCommented:
0
kevp75Commented:
here is what GoDaddy states:

>>
Thank you for contacting Online Support.

We do not allow external connections to our databases. Use the following directions to access the management tools for your database:

First, log into your customer account:

. Go to the Go Daddy Account Login Page
. Log in using your account username (which may be the same as your customer number) and password

If you have trouble logging in, our password reset form may help you. You can find this form through the following link: Password Reset Form

Once logged in just follow these steps:

. Select 'Web Hosting & Databases' from the 'Hosting & Email' menu at the top of the page
. Click the 'Open' link under the Control Panel column for the hosting account which holds your database
. Click the button for the type of database you are working with

To access the database details (hostname, username, password):
. Click on the username or the 'edit' icon for the database. You can also reset the password and create a DSN from this screen

To edit the database:
. Click the 'Open Manager' button (MySQL/MSSQL)
. MySQL will launch phpMyAdmin and prompt you to login with the username and password for the database
. MSSQL will launch SQL Server Web Admin. You will need to click the [+] next to 'Connection' and click 'Connection'. This will prompt you to login with the username and password for the database

Sincerely,

Mike P.
Online Support Technician
<<
0
stevecaAuthor Commented:
In the meantime I have signed up for a hosting account with another provider and ran into the same issue there, even though at first their suppor desk stated I could make the connection.

So I am looking for yet another hosting provider which will allow me to connect to the database on my home computer. It seems many providers have firewalls in place to prevent this.
0
kevp75Commented:
0
kevp75Commented:
and if it doesn't work there let me know.  I'll get it working  
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stevecaAuthor Commented:
SOLUTION:

I switched to www.namespro.ca for the hosting and used the following connection code:

<%
Dim oConn
Dim connectstr

connectstr ="driver={MySQL ODBC 3.51 Driver};server=*********;database=*****;uid=**********;password=***********"

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

Set oConn = nothing
%>

Thanks kevp75 for sticking with me through this!
0
kevp75Commented:
:)
glad I could.

Yeah that driver is actually (IMHO) the better one to use.  I've tried all sorts on our servers, and we've actually gotten the best performace by using that one...(it's the actual driver from the makers of mySQL)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.