Sunday, May 1, 2011

Cannot connect to remote MySQL DB from GoDaddy

I developed an ASP application (VBScript backend, JavaScript frontend) that makes use of a remote MySQL database (Bugzilla). The applicaiton works well on a localhost, yet fails to work when uploaded to GoDaddy. Spending two hours on the phone with GoDaddy's support didn't help...

The error I'm getting is:

==============================================================

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

==============================================================

My connection string is:

"DRIVER={MySQL ODBC 5.1 Driver}; SERVER=xxx.org; DATABASE=xxx;UID=xxx;PWD=xxx;OPTION=16427"

I tried to modify it by removing the OPTION, changing the MySQL driver, reducing the driver to DRIVER={MySQL}, changing the case of UID and PW, etc. - no progress...

I would appreciate any help.

From stackoverflow
  • Ask Godaddy if they have the MySQL ODBC Driver installed on the server that hosts your website.

  • http://help.godaddy.com/article/253

    This example describes using ASP/ADO to connect to a MySQL Database.

    <%
    Dim oConn, oRs
    Dim qry, connectstr
    Dim db_name, db_username, db_userpassword
    Dim db_server
    
    db_server = "mysql.secureserver.net"
    db_name = "your_dbusername"
    db_username = "your_dbusername"
    db_userpassword = "your_dbpassword"
    fieldname = "your_field"
    tablename = "your_table"
    
    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
    
    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
    
    %>
    
    jim : In other words.. change the driver version

0 comments:

Post a Comment