Srinivas Mantha
asked on
: ODBC connection to MySQL from standard ASP code
I am very familiar with using DSN connections in my standard ASP codes getting connected to MS Access.
I am using traditional ASP and want to get connected to MySQL database on my local server. Local computer is windows 7 professional (32 bit). I downloaded the relevant MySQL ODBC 5.1 driver from
www.mysql.com.
I am testing the ASP code in my local host. It is giving ODBC connection error message.
Initially, I tried creating a system DSN. DSN was created successfully. It gave a message “connection successful” when I pressed the button “test”. When I tried to open the DSN in administrative tools to look for the configuration again, it is giving the message “Invalid attribute string”.
I have searched web for the solution to the problem on
http://bugs.mysql.com/bug.php?id=56233
I have gone through the discussions.
I am not able to find the solution
Instead of DSN-based connection, I tried to use the DSN-less connection in ASP code which is as follows:
========================== ========== ========== ========== ==
<.html>
…..
<table></tr>
<%
Set objdbconmysqldemostr=Serve r.CreateOb ject("ADOD B.connecti on")
set rsusers=server.createobjec t ("adodb.recordset")
objdbconmysqldemostr.Open ("DRIVER={MySQL ODBC 3.51 Driver};" & _
"Server=localhost;" & _
"Port=3306;" & _
"Option=16384;" & _
"Stmt=;" & _
"Database=abcxyz;" & _
"User=root;" & _
"Password=thefire")
rsusers.open "select * from userlogin order by ename",objdbconmysqldemost r,1,1
dim rn,mr
rn=0
while not rsusers.eof
rn=rn+1
response.write "<td>" & rn & "</td>"
response.write "<td>" & rsusers("username") & "</td>"
response.write "<td>" & rsusers("password") & "</td>"
response.write "<td>" & rsusers("ename") & "</td></tr>"
rsusers.movenext
wend
rsusers.close
set rsusers=nothing
objdbconmysqldemostr.close
set objdbconmysqldemostr=nothi ng
%>
</table>
……………
</html>
Again the same problem with database connection
Any thoughts for solving the problem
I am using traditional ASP and want to get connected to MySQL database on my local server. Local computer is windows 7 professional (32 bit). I downloaded the relevant MySQL ODBC 5.1 driver from
www.mysql.com.
I am testing the ASP code in my local host. It is giving ODBC connection error message.
Initially, I tried creating a system DSN. DSN was created successfully. It gave a message “connection successful” when I pressed the button “test”. When I tried to open the DSN in administrative tools to look for the configuration again, it is giving the message “Invalid attribute string”.
I have searched web for the solution to the problem on
http://bugs.mysql.com/bug.php?id=56233
I have gone through the discussions.
I am not able to find the solution
Instead of DSN-based connection, I tried to use the DSN-less connection in ASP code which is as follows:
==========================
<.html>
…..
<table></tr>
<%
Set objdbconmysqldemostr=Serve
set rsusers=server.createobjec
objdbconmysqldemostr.Open ("DRIVER={MySQL ODBC 3.51 Driver};" & _
"Server=localhost;" & _
"Port=3306;" & _
"Option=16384;" & _
"Stmt=;" & _
"Database=abcxyz;" & _
"User=root;" & _
"Password=thefire")
rsusers.open "select * from userlogin order by ename",objdbconmysqldemost
dim rn,mr
rn=0
while not rsusers.eof
rn=rn+1
response.write "<td>" & rn & "</td>"
response.write "<td>" & rsusers("username") & "</td>"
response.write "<td>" & rsusers("password") & "</td>"
response.write "<td>" & rsusers("ename") & "</td></tr>"
rsusers.movenext
wend
rsusers.close
set rsusers=nothing
objdbconmysqldemostr.close
set objdbconmysqldemostr=nothi
%>
</table>
……………
</html>
Again the same problem with database connection
Any thoughts for solving the problem
ASKER
Again the same problem. The log file on IIS 7.5 shows the following message:
2011-02-26 01:39:17 ::1 GET /mydomain/mysqldemo/mysqld emouserlis t1.asp |39|80004005|[Microsoft][O DBC_Driver _Manager]_ Data_sourc e_name_not _found_and _no_defaul t_driver_s pecified 80 - ::1 Mozilla/4.0+(compatible;+M SIE+7.0;+W indows+NT+ 6.1;+Tride nt/4.0;+GT B6.6;+SLCC 2;+.NET+CL R+2.0.5072 7;+.NET+CL R+3.5.3072 9;+.NET+CL R+3.0.3072 9;+Media+C enter+PC+6 .0;+.NET4. 0C;+AskTB5 .5) 500 0 0 0
I think problem is with ODBC driver for mysql
2011-02-26 01:39:17 ::1 GET /mydomain/mysqldemo/mysqld
I think problem is with ODBC driver for mysql
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I downloaded the following driver from www.mysql.com
Windows (x86, 32-bit), MSI Installer
Connector-ODBC 5.1.8
Among mirror sites I have chosen, Hoobly Classifieds / Chicago, IL, United States HTTP
I reinstalled the driver and restarted the system. I created a new DSN for mysql database. It was configured correctly without errors. I used the DSN connection in my ASP code.
I worked perfectly
thanks for the prompt support
Windows (x86, 32-bit), MSI Installer
Connector-ODBC 5.1.8
Among mirror sites I have chosen, Hoobly Classifieds / Chicago, IL, United States HTTP
I reinstalled the driver and restarted the system. I created a new DSN for mysql database. It was configured correctly without errors. I used the DSN connection in my ASP code.
I worked perfectly
thanks for the prompt support
You're welcome, thanks for the points.
Open in new window