MYSQL AND ASP CLASSIC

www.

How do I make a connection to a MySQL database using ASP?

The following article explains how to make a connection to a MySQL database using ASP from a Windows server. The method used will be a DSN-less connection, which requires you to specify the servername, database, username and password. Currently we do not support DSN connections to MySQL databases using ASP.

Note: The MySQL database is stored on a Linux server, which means your SQL statements need to be case sensitive. For example, “SELECT * FROM Table” and “SELECT * FROM table” will be interpreted as two different SQL statements.

In the following examples, please substitute your information where the following data is referenced:

  • server: enter the MySQL server that you are assigned to, for example, mysql4.safesecureweb.com
  • username: enter the username provided for your database
  • password: enter the password provided for your database
  • database: enter the database name provided for your database

To make a DSN-less connection to a MySQL database, the following code snippet can be used:


<%
set conn = Server.CreateObject("ADODB.Connection")
conn.open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=server; PORT=3306; DATABASE=database; UID=username; PWD=password; OPTION=3;"
%>

Comments are closed.