Last updated: August 27, 2026.
Connect Classic ASP through ADO and a configured MySQL ODBC data source. Store credentials in protected configuration and use a database account with only the required permissions.
Open the connection and run a parameterized query
<%
Const adCmdText = 1
Const adInteger = 3
Const adParamInput = 1
Dim connection, command, records, customerId
customerId = CLng(Request.QueryString("customer_id"))
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open "DSN=AppMySQL;UID=app_user;PWD=use-a-secret-store;"
Set command = Server.CreateObject("ADODB.Command")
Set command.ActiveConnection = connection
command.CommandType = adCmdText
command.CommandText = "SELECT customer_name FROM customers WHERE customer_id = ?"
command.Parameters.Append command.CreateParameter("customer_id", adInteger, adParamInput, , customerId)
Set records = command.Execute
If Not records.EOF Then Response.Write Server.HTMLEncode(records("customer_name"))
records.Close
connection.Close
%>Create the DSN with the installed MySQL Connector/ODBC driver and test it under the same Windows architecture as the IIS application pool.
Need a browser-based front end for MySQL? PHPRunner can build forms, reports, and authenticated database pages.