How do I connect to MySQL with ASP?

This applies to Windows Hosting accounts only.

You will need to use a DSNless connection which can be achieved by using code with the following VBscript:

set rsEvents = Server.CreateObject("ADODB.Recordset")
rsEvents.ActiveConnection = "Driver={MySQL ODBC 5.1 Driver}; DATABASE=databasename;USER=username; PASSWORD=password; Server=127.0.0.1"

...or the following JScript:

var rsEvents = Server.CreateObject("ADODB.Recordset");
rsEvents.ActiveConnection = "Driver={MySQL ODBC 5.1 Driver}; DATABASE=databasename;USER=username; PASSWORD=password; Server=127.0.0.1";

  • 131 Users Found This Useful
Was this answer helpful?

Related Articles

How do I connect to my MySQL database from a Perl CGI script?

Perl's DBI module provides an interface to MySQL databases for CGI scripts. A commented example...

How do I query a MySQL database from a PHP script?

Use the following outline to connect and begin querying the MySQL server from within your PHP...

How do I set up the MySQL connection using Dreamweaver?

1. Open Dreamweaver2. Click File>New3. Choose “Dynamic Page” in left frame and then “PHP” (or...

Can I rename my database getting rid of the 'web-' part of the name?

Unfortunately this isn't possible as the convention is required for backing up the data on the...

What are the default / allowed privileges for MySQL databases?

By default on all MySQL databases the current privileges are given -SELECT, INSERT, UPDATE,...