Connect to MySQL database from ASP

Iíll show you how to connect to MySQL database from ASP script. Once we have connected to the MySQL database from ASP, youíll learn how to select data from a MySQL database table and display the results in a browser.

In order to connect to MySQL database from ASP you need to install MySQL ODBC Driver-MyODBC 3.51. You can download the MySQL driver from the URL below:

Dim sConnection
Dim oConnection
Dim oRS 

sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=; UID=;PASSWORD=< Put your MySQL password here >; OPTION=3" 

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


Set oRS = oConnection.Execute("SELECT * FROM Table1")

While Not oRS.EOF
  Response.Write oRS ("Column1") & "  " & oRS ("Column2") & "
" oRS.MoveNext Wend oRS.Close Set oRS = Nothing oConnection.Close Set oConnection = Nothing %>

MySQL database is a great database server, which can be used as a website backend. You can install MySQL on your local development machine and test your ASP MySQL connections from there. Many Windows web hosting providers offer MySQL hosting as a standard feature, and many Windows web developers use MySQL as website database engine.

SQL Strings Home | SQL Server connection strings | MS Access connection strings | MySQL connection strings | Oracle connection strings | Database Glossary | MySQL PHP Connection | MySQL Perl Connection | MS Access ASP Connection | MS SQL Server ASP Connection | MySQL ASP.NET Connection | MySQL ASP Connection