Facebook

How can I make a DSN-less connection to a mySQL database?

1) Define a connection string.
Ex: strConnectString = “Driver={MySQL};Server=servername;Database=
dbnam;Uid=userid;Pwd=password”

2) Create a database connection instance.
Ex: set Connection = Server.CreateObject(“ADODB.Connection”)

3) Open the database connection.
Ex: Connection.Open strConnectString

4)You may also want to set the connection timeout value.
Ex: connection.ConnectionTimesout = 100

5) You can then execute your database queries.
Ex: result = Connection.Execute(“SELECT * FROM table”);