Option Explicit
Public cnDB As ADODB.Connection
Public dbRS As ADODB.Recordset
Public dbRS2 As ADODB.Recordset
Public Function MySQL_Conn() As Boolean
On Error Resume Next
Dim ip, dbname, uuser, upwd As String
Dim CnString As String
Set cnDB = New ADODB.Connection
CnString = "DRIVER={MySQL ODBC 5.2 ANSI Driver};" & _
"SERVER = 서버의 아이피 주소;" & _
"PORT=3306" & _
"DATABASE = 데이타베이스명;" & _
"UID=아이디;PASSWORD=비밀번호;OPTION=3"
With cnDB
.ConnectionString = CnString
.CursorLocation = adUseClient
.ConnectionTimeout = 30
.Open
End With
If cnDB.State <> adStateOpen Then
MsgBox cnDB.Errors.item(cnDB.State), vbExclamation, "데이터베이스 연결 오류"
MySQL_Conn = False
Else
MySQL_Conn = True
End If