Cannot connect to MySQL with Classic ASP

Discussion in 'Databases' started by JFGray, Aug 4, 2023.

  1. I'm setting up a new site to demonstrate capabilities on a new project. I'm copying a lot of code and structure from an existing system already in use. For some reason, I cannot connect to the MySQL database on the new site. I'm using the code below, which works fine on the existing system (also on WinHost) but not here:

    dbserver = "my01.winhost.com"
    dbname = "mysql_159797_survey"
    dbUserName = "********" ( of course in the working version this is the real database user name)
    dbuserpassword = "*******" (of course in the working version this is the real database password)
    connectstr = "Driver={MySQL ODBC 5.2w Driver};SERVER=" & dbServer & ";DATABASE=" & dbName & ";UID=" & dbUserName & ";PWD=" & dbUserPassword
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open connectstr

    What I get in response is:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [MySQL][ODBC 5.2(w) Driver]Access denied for user 'assessment'@'192.168.110.145' (using password: YES)


    I'm stuck as to why this works on one application but not on the new one. Is there a permission setting for DB access that I'm missing somewhere?

    thanks,
    Jon
     
  2. ComputerMan

    ComputerMan Winhost Staff

  3. OK, an A-HA moment when I put the information together for the support ticket. I put in a test line to print out the connection string right before the connection to show what was used. I realized (duh!!) that a special character in the original password was messing up the password when it was passed through the code. Fixed the password, and all is working now.
     

Share This Page