Bug #29892 MyODBC 3/ADO Incorrect error when trying to access a table that doesn't exist
Submitted: 19 Jul 2007 8:16 Modified: 13 Mar 2008 18:19
Reporter: Erica Moss Email Updates:
Status: Won't fix Impact on me:
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.17 OS:Microsoft Windows (xp sp 2)
Assigned to: Jim Winstead CPU Architecture:Any

[19 Jul 2007 8:16] Erica Moss
When a record set attempt to open using a command that references a table that doesn't exist on the server, the following error is received:
"-2147217887:ODBC driver does not support the requested properties."

This only happens when the cursor location is adUseServer and the cursor type is adOpenStatic.  In other cases the error is:
"-2147217865:[MySQL][ODBC 3.51 Driver][mysqld-5.0.37-community-nt-log]Table 'ado.ado_test' doesn't exist"

ODBC trace files are attached.

How to repeat:
Sub MissingTable()
    On Error GoTo EH
    Dim strSQL As String
    Dim strConn As String
    Dim connection1 As adodb.Connection
    Dim recset1 As adodb.Recordset

    Set connection1 = New adodb.Connection
    Set recset1 = New adodb.Recordset
    strSQL = "SELECT * from ado_test"
    strConn = "DRIVER={MySQL ODBC 3.51 Driver};" & _
        "SERVER=localhost;DATABASE=ado" & _

    ' open connection
    connection1.ConnectionString = strConn
    connection1.CursorLocation = adUseServer
   ' open recordset
    recset1.Open strSQL, connection1, adOpenStatic, adLockOptimistic, adCmdText
    Set recset1 = Nothing
    Set connection1 = Nothing
    Exit Sub
    Debug.Print Err.Number & ":" & Err.Description
    Resume Next
End Sub
[19 Jul 2007 8:16] Erica Moss
wrong error

Attachment: SQL wrong error.LOG (application/octet-stream, text), 30.88 KiB.

[19 Jul 2007 8:16] Erica Moss
right error

Attachment: SQL right error.LOG (application/octet-stream, text), 27.45 KiB.

[13 Mar 2008 18:19] Jess Balint
There doesn't seem to be a way to influence the error that ADO (or the OleDB layer) is reporting back. I also tried 42S01 (ODBC v3 error) without success.