Helpdesk
10.06.2025 17:11 29 Displayed

How to provide ASP MysQL Connection?

Below is a basic connection code used to connect to a MySQL database in an ASP page. 

In this example, the ADODB.Connection object is used to connect to the MySQL ODBC driver. A connection is established via.

<% 

SQLserveradr="server"

SQLdatabase="database"

SQLlogin="user name"

SQLpassword="password"

' ADODB.Connection object is created

Set Conn = Server.CreateObject("ADODB.Connection")

'Connection string is prepared

conStr = "driver={MySQL ODBC 3.51 Driver};server=" & SQLserveradr & ";database=" & SQLdatabase

conStr = conStr & ";uid=" & SQLlogin & ";pwd=" & SQLpassword & ";OPTION=3"

' Link opens

Conn.Open conStr 

How to provide ASP MysQL Connection?