Description:
This problem was discovered running ADO compliance test cndefdat.vbs.TestExecuteValid()
If either this testcase, or the VB function below are run against MyODBC 3.51, the "Current Catalog" property node is found in the connection.Properties collection, and the Default Database property are both assigned correctly to the database specified in the connection string.
When run against MyODBC 5.0 neither value is populated, and an error is thrown when attempting to access the Default Database property:
"Provider does not support the property."
How to repeat:
FIRST:
mysql> CREATE DATABASE ad0;
NEXT:
Option Explicit
Dim strSQL As String
Dim strConn As String
Dim oConn As adodb.Connection
Dim prop As Variant
Private Sub Test()
On Error GoTo EH
Set oConn = New adodb.Connection
Set oRs = New adodb.Recordset
strSQL = "select 1"
' strConn = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=localhost;DATABASE=ado" & _
";USER=root;PASSWORD=mypass;OPTION=3;"
strConn = "DRIVER={MySQL Connector/ODBC v5};" & _
"SERVER=localhost;DATABASE=ado" & _
";UID=root;PWD=mypass;OPTION=3;"
oConn.ConnectionString = strConn
oConn.CursorLocation = adUseClient
oConn.Open
For Each prop In oConn.Properties
If prop.Name = "Current Catalog" Then
MsgBox "found it"
Exit For
End If
Next
MsgBox oConn.DefaultDatabase ' FAILS HERE WITH MYODBC 5.0
MsgBox oConn.Properties("Current Catalog")
Exit Sub
EH:
MsgBox Err.Number & ":" & Err.Description
End Sub
Description: This problem was discovered running ADO compliance test cndefdat.vbs.TestExecuteValid() If either this testcase, or the VB function below are run against MyODBC 3.51, the "Current Catalog" property node is found in the connection.Properties collection, and the Default Database property are both assigned correctly to the database specified in the connection string. When run against MyODBC 5.0 neither value is populated, and an error is thrown when attempting to access the Default Database property: "Provider does not support the property." How to repeat: FIRST: mysql> CREATE DATABASE ad0; NEXT: Option Explicit Dim strSQL As String Dim strConn As String Dim oConn As adodb.Connection Dim prop As Variant Private Sub Test() On Error GoTo EH Set oConn = New adodb.Connection Set oRs = New adodb.Recordset strSQL = "select 1" ' strConn = "DRIVER={MySQL ODBC 3.51 Driver};" & _ "SERVER=localhost;DATABASE=ado" & _ ";USER=root;PASSWORD=mypass;OPTION=3;" strConn = "DRIVER={MySQL Connector/ODBC v5};" & _ "SERVER=localhost;DATABASE=ado" & _ ";UID=root;PWD=mypass;OPTION=3;" oConn.ConnectionString = strConn oConn.CursorLocation = adUseClient oConn.Open For Each prop In oConn.Properties If prop.Name = "Current Catalog" Then MsgBox "found it" Exit For End If Next MsgBox oConn.DefaultDatabase ' FAILS HERE WITH MYODBC 5.0 MsgBox oConn.Properties("Current Catalog") Exit Sub EH: MsgBox Err.Number & ":" & Err.Description End Sub