Bug #36996 Data provider or other service returned an E_FAIL status
Submitted: 27 May 2008 6:45 Modified: 18 Nov 2009 14:32
Reporter: Alexey Palagin Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1 OS:Microsoft Windows (xp sp2 rus)
Assigned to:
Tags: ODBC, VB
Triage: D3 (Medium)

[27 May 2008 6:45] Alexey Palagin
Description:
When opening ADO.Recordset from MS Access 2003 a run-time error occurs:

ErrNo: -2147467259 ErrMessage: Data provider or other service returned an E_FAIL status.

There is no deal with DATETIME fields. I should say even more - it concerns CHAR fields.

How to repeat:
First, create MySQL table:

CREATE TABLE `odbctest` (
  `Id` int(10) unsigned NOT NULL auto_increment,
  `MessageText` char(32) character set cp1251 collate cp1251_bin NOT NULL,
  `MessageDate` datetime NOT NULL,
  `MessageValue` double NOT NULL,
  PRIMARY KEY  (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251; 

Second, MS Access code:

Dim ConnectionString As String
    ConnectionString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;PORT=3306;DATABASE=dbtest;USER=dbuser;PASSWORD=dbpass;OPTION=3;"
    Dim MySQLConnection As New ADODB.Connection

    MySQLConnection.ConnectionString = ConnectionString
    MySQLConnection.CursorLocation = adUseClient
    
    MySQLConnection.Open
    If MySQLConnection.State = adStateOpen Then
        Debug.Print "Connection success"
        
        Dim MySQLRecordset As New ADODB.Recordset
        
        MySQLRecordset.CursorLocation = adUseClient
        MySQLRecordset.CursorType = adOpenStatic
        On Error Resume Next
        MySQLRecordset.Open "SELECT Id, MessageDate, MessageValue, MessageText FROM odbctest", MySQLConnection, adOpenForwardOnly, adLockReadOnly
        If Err <> 0 Then
            Debug.Print "ErrNo: " & Err.Number & " ErrMessage: " & Err.Description
        End If
        
        If MySQLRecordset.State = adStateOpen Then
            Dim RowCount As Long
            RowCount = MySQLRecordset.RecordCount
            Debug.Print "Recordset success"; RowCount
            While Not MySQLRecordset.EOF
                
                Debug.Print "Id:" & MySQLRecordset!Id & " Date:" & MySQLRecordset!MessageDate & " Value:" & MySQLRecordset!MessageValue & " Text:" & MySQLRecordset!MessageText
                MySQLRecordset.MoveNext
            Wend
            MySQLRecordset.Close
        Else
            Debug.Print "Recordset failed"
        End If
        MySQLConnection.Close
    Else
        Bedug.Print "Connection failed"
    End If

But if change query to:

SELECT Id, MessageDate, MessageValue FROM odbctest

everything goes just fine.
[6 Jun 2008 23:16] Jess Balint
Verified just as described. Thanks for a good bug report.
[7 Jun 2008 0:17] Jess Balint
patch + test

Attachment: bug36996.diff (application/octet-stream, text), 2.28 KiB.

[7 Jun 2008 0:18] Jess Balint
The core issue here is that cp1251 is not supported in the client/driver due to bug#32831.

Patch adds an error if it encounters an unsupported client character set.
[17 Nov 2009 20:35] Lawrenty Novitsky
Approved and pushed as rev#858. Will released in 5.1.7

Bug is actually duplicate of the Bug#39831(or vice versa)

Patches intersect. So from with patch was wchar part only used, Testcase doesn't make sense any more since 5.1.6 was already linked against libmysll with Bug#32831 fixed.
[18 Nov 2009 14:32] Tony Bedford
An entry has been added to the 5.1.7 changelog:

When opening ADO.Recordset from Microsoft Access 2003, a run-time error occurred:

ErrNo: -2147467259 ErrMessage: Data provider or other service returned an E_FAIL status.