I am trying to connect WAMP MySQL with VBA. I have the tables created in the database using PHPMyAdmin. I have referenced Microsoft ActiveX Data Objects 2.8 Library and have installed MySQL Connector/ODBC 5.1 driver. I am not able to connect to mysql. My code is
Dim oConn As ADODB.Connection
Private Sub ConnectDB()
Set oConn = New ADODB.Connection
oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _
"SERVER=127.0.0.1;" & _ ' Tried localhost too
"DATABASE= dbtest;" & _
"USER=root23;" & _
"PASSWORD=pass;" & _
"PORT=3306;"& _
"Option=3"
End Sub
The error is
Microsoft ODBC Driver Manager. Data Source name not found or no default driver specified. All services in my WAMP are running. My http://localhost/phpmyadmin/ page opens fine. I also tried putting PORT=3306 too.