1

I have a ASP application running on a IIS7 server on Windows Vista Home Premium (developing environment). The application has an ASA file to configure connections to the database:

<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart
    Application("db") = 2
    Application("dbconnect") = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Port=3306;Option=0;Socket=;Stmt=;Uid=root;Pwd=root;CLIENT_MULTI_STATEMENTS=1;Database=appadmin;"
End Sub
</SCRIPT>

Then, requests are handled in asp pages, which first load configuration with the following code:

Session("configid") = 1
dbConnect = Application("dbconnect")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open (dbConnect)
sql = "select * from settings where configid = "&Session("configid")
Set RS = ExecuteRecordset(sql)
...

Everything seems fine, however, on any request to the site, it logs the following error:

|11|80004005|[Microsoft][ODBC_Driver_Manager]_Data_source_name_not_found_and_no_default_driver_specified 80

Opening a command prompt and running "mysql -uroot -proot -D appadmin" connects to the database without problem.

Any ideas as to what may be causing the problem?

2
  • Sorry to bump and old question, but is there a solution for this? I have same problem with IIS 7 and MySQL 5.5 I try drivers MySQL ODBC 5.1 and 3.51 Commented May 9, 2011 at 11:17
  • This code is vulnerable to sql injection Commented Dec 1, 2011 at 3:31

1 Answer 1

2

My connection string look like this

ConnectionString="Driver={MySQL ODBC 3.51 Driver}; Server=127.0.0.1;Port=3306;
Database=MyDB;User=MyUser;Password=MyPassword;Option=3;" 

Looks like yours are missing the user and password and have Option=0 instead of 3

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.