0

ASP - MySQL Connector/ODBC

Wednesday, November 7, 2007

<%
'==============================================
' Test mySQL connection
' This test can be used on .NET 1.1 and 2.0
' This test uses the MySQL Connector/ODBC 3.51
' Testing only the connection to the database
'==============================================

'Dim the variables
Dim sConnection, objConn, database, username, password

'SET THE VARIABLES HERE
database = ""
username = ""
password = ""



'create the connection object
Set objConn = Server.CreateObject("ADODB.Connection")

'connection string
sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE="+ database +"; UID="+
username +";PASSWORD="+ password +"; OPTION=3"

'open the connection
objConn.Open(sConnection)

'
'this is where you would see the code to do stuff with the database
'

'close the connection and kill the object
objConn.Close
Set objConn = Nothing
%>

mySQL Connection



Test MySQL Connection
If you do not see any errors then the connection was successful


0 Responses to "ASP - MySQL Connector/ODBC"