DS's『 행복합시다 』

Carpe Programming/oracle

[MySQL] ASP + MySQL Connection

nolite 2013. 6. 14. 17:13

1. use system dsn

 

Dim adoConn

 

Set adoconn = Server.CreateObject("ADODB.Connection")

adoConn.Open "DSN=TextODBC;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.2 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

 

 

 

728x90