My ODBC driver for new MySQL version 5.2

dinotom

Active Member
Joined
Aug 2, 2009
Messages
357
I just upgraded to MySQL Connector/ODBC 5.2 from 5.1 and now my db connections don't work as I have wrong driver text in my functions. I've gone to their site and Googled for it but I cannot find it. Does anyone know what the new driver string is?

This is the code I used successfully before, I need a new DRIVER string for version 5.2. Any help appreciated

Code:
Public Sub ConnectDB(server As String, user As String, password As String, Optional Database As String, Optional testmode As Boolean)
    On Error GoTo ErrHandler
    Set oConn = New ADODB.Connection
        oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _
         "SERVER=" & server & ";" & _
         "DATABASE=" & Database & ";" & _
         "USER=" & user & ";" & _
         "PASSWORD=" & password & ";" & _
         "Option=3"


    If testmode = True Then
        MsgBox "Database Connection Test Successful!", vbInformation, "Success!"
        'cmdInsertData.Enabled = True
    End If
    Exit Sub
ErrHandler:
    MsgBox Err.Description, vbCritical, Err.Source
End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Yes, I know and that is what I upgraded to. But I need to know what part of this Driver string changed so that excel can communicate with mysql via odbc with this connector.

old string that works with prior connector version oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};"
new string for version 5.2 oConn.Open "Driver={ ? };"
 
Upvote 0
yes and get the same error. I even went back and removed the new connector and re-installed the old one and am now getting the same error!
 
Upvote 0
I tried all those variations still getting this error
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
 
Upvote 0
Thomas

Which version did you install, the 32 bit or 64 bit?

I originally tried with the 64 bit but experienced the problems you described.

I then installed the 32 bit version and ran this code without problems.
Code:
Private Sub GetTheWorld()

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim fld As ADODB.Field
Dim strConn As String
Dim sql As String


    Set conn = New ADODB.Connection

    strConn = "DRIVER={MySQL ODBC 5.2a Driver};"
    strConn = strConn & "SERVER=localhost;"
    strConn = strConn & "DATABASE=World;"
    strConn = strConn & "UID=userid;PWD=password"

    conn.ConnectionString = strConn
    
    conn.Open

    sql = "SELECT * FROM country;"
    Set rs = New ADODB.Recordset
    rs.Open sql, conn


    Range("A1").CopyFromRecordset rs

    Set rs = Nothing
    Set conn = Nothing

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,923
Messages
6,175,410
Members
452,640
Latest member
steveridge

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top