Web Hosting, Programming, Marketing & Web Design Solutions By Sunny Oasis

Connecting to a MySQL Database

How do I make a connection to a MySQL database using ASP, Perl, or ColdFusion?

The following article explains how to make a connection to a MySQL database using ASP, Perl or ColdFusion. 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


<CFQUERY Name="test" DATASOURCE="<DSN>" USERNAME="<username>" PASSWORD="<password>">



use DBI;

$db = DBI->connect("dbi:mysql:<database>:<servername>","<username>","<password>")
or die("Couldn't connect");



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

Web Hosting - $15.CDN per month, FREE set-up!
For more information, give us a call:
In North America:   1-800-763-3575
Toll Free outside North America:   800-7633-5750
or email: Sales@sunnyoasis.com

 History | Technology | Comparison | Rates | FAQ | Engine Register | Domain Names | Contact | Client Info | Home

Overview Of Our Services
Copyright: 2010 SUNNY OASIS, All rights reserved