반응형
In order to connect to MySQL database from ASP you need to install MySQL ODBC connector. You can download the MySQL driver from the URL below
http://dev.mysql.com/downloads/connector/odbc/
1. Use System DSN
Open Data Sources(ODBC) and add System DNS
Dim adoConn
Set adoConn = Server.CreateObject(“ADODB.Connection”)
adoConn.Open “DSN=TestODBC;Uid=UserID;Pwd=Password;”
If adoConn.errors.count = 0 then
Response.Write “Connected Successfully!”
Else
Response.Write “Connection fail!”
End if
adoConn.close
Set adoConn = nothing
2. Use ODBC Driver
Dim adoConn
Set adoConn = Server.CreateObject(“ADODB.Connection”)
adoConn.Open “Driver={MySQL ODBC 5.1 driver}; Server=localhost; "&_
" Database=TestDB;Uid=UserID;Pwd=Password;”
If adoConn.errors.count = 0 then
Response.Write “Connected Successfully!”
Else
Response.Write “Connection fail!”
End if
adoConn.close
Set adoConn = nothing
반응형
'PROGRAMING > CLASSIC ASP' 카테고리의 다른 글
[ASP] ASP Encoding 설정 (0) | 2011.06.09 |
---|---|
[ASP] 반올림 (0) | 2011.05.26 |
[ASP] Split를 이용한 2차원배열 (0) | 2011.04.12 |
[ASP] Dynamic Array in Classic ASP (2) | 2011.03.31 |