Connection to MySQL with ASP

When you need to open access to a MySQL database, you should use an ADO database connection.
It can be set up as follows:

<%
SQLserveradr="[mysqlserver]"
SQLdatabase="[mysqldatabase]"
SQLlogin="[mysqlusername]"
SQLpassword="password"

Set Conn = CreateObject("ADODB.Connection")

conStr = "driver={MySql};server="& SQLserveradr &";database="& SQLdatabase
conStr = conStr & ";uid="& SQLlogin &";pwd="& SQLpassword & ";OPTION=3"

Conn.Open conStr
%>

The OPTION part of the connection string can vary depending on the context in which you use your connection; normally either 3 or 16386 is recommended – see the MySQL ODBC connector documentation for further details.

Article from the support category: ASP & ASP.NET

Other relevant articles