Bug #35880 Failure to retrieve data from the database mysql or information_schema with ODBC
Submitted: 7 Apr 2008 16:47 Modified: 9 Apr 2008 10:54
Reporter: deng jack
Status: Verified
Category:Connector/ODBC Severity:S2 (Serious)
Version:5.1.3 OS:Any
Assigned to: Lawrin Novitsky Target Version:
Triage: D2 (Serious)

[7 Apr 2008 16:47] deng jack
Description:
    When I tried to retrieve data from the database "mysql" or "information_schema" with
ODBC driver in my Visual FoxPro application, my application crashed. And the same thing
came up in "Microsft Access 2003" or "Microsft Excel 2003".
    But if I start the MySQL Server 5.0, I would succeed to retrieve data from the
database mysql or information_schema with ODBC driver.

How to repeat:
1. Start your MySQL server(version 6.0.4).
2. Add a new DSN named "MysqlTest" in the "Windows ODBC data source manager with "MySQL
ODBC 5.1 Driver". Set the "Database" parameter to "information_schema" or "mysql", and
configure other connection parameters. And then click button "OK".
3. Start "Microsft Access 2003" and create a new empty database named "db1". Next, select
the item "Import..." of menu "File". In the "Import" dialog, click "File type" combobox
and select the item "ODBC Database". Click button "OK".
4. In the "select data source" dialog, select the data source named "MysqlTest" and click
button "OK".
5. In the "import object" dialog, select a table(e.g. TABLES) and click button "OK".
Microsoft Access would crash.
6. Start "Microsft Access 2003" and open the Access database named "db1" again, we would
find a table named "TABLES" but without any records!
[8 Apr 2008 8:43] Tonci Grgin
Hi Deng and thanks for your report.

Verified just as described against '6.0.5-alpha-nt-debug-log'.

Notes: 
  Using 5.1 server one gets no error.
  Using any other database but 'mysql'/'I__S' with server 6.0 one gets no error (this
could be due to different structure of "ordinary" tables (less fields) but I didn't
investigate further as it seems important to deal with this bug ASAP).
  I used mysql.user table for testing with 6.0.
[9 Apr 2008 10:49] deng jack
Another bug?  Failure to execute specific MySQL Statements with ODBC driver.
    On the other hand, when I started MySQL Server 6.0.4 and tried to excute MySQL
Statement "SHOW CREATE TABLE"(and other "SHOW" Statements) with ODBC driver in my Visual
FoxPro application, my application crashed. And the same thing came up in Microsft Visual
Basic application. I could not conclude whether associate it with the Bug#35880.
    But if I start the MySQL Server 5.0, I would succeed.

    How to repeat:
1. Start MySQL server(version 6.0.4).
2. Start Visual Basic 6.0 and create a new standard EXE project.
3. Add a reference of "Microsoft ActiveX Data Objects 2.x Library" to the project. 
4. Draw a button named "Command1" on the form. 
5. Double click the button "Command1" and paste following code to overwrite it's click
event routine:
      Private Sub Command1_Click()
         Dim conn As ADODB.Connection
         Dim rs As ADODB.Recordset
         Dim rsfield As ADODB.Field
         Dim strResult As String
   
         'Connect to MySQL server using MySQL ODBC 5.1.3 Driver
         Set conn = New ADODB.Connection
         conn.ConnectionString = "DRIVER={MySQL ODBC 5.1
Driver};SERVER=localhost;DATABASE=yourDB;UID=user;PWD=password;OPTION=3"
         conn.Open
         'Excute statement
         Set rs = conn.Execute("SHOW CREATE TABLE yourTable")
         For Each rsfield In rs.Fields
             strResult = strResult & rsfield.Name & ":   " & rsfield.Value & vbCrLf
         Next
         conn.Close
         MsgBox strResult
      End Sub
6. Press the key F5 to start debugging the project. Click the button "Command1", now
Microsoft Visual Basic would crash.
[9 Apr 2008 10:54] deng jack
Another bug?  Failure to execute specific MySQL Statements with ODBC driver.
    On the other hand, when I started MySQL Server 6.0.4 and tried to excute MySQL
Statement "SHOW CREATE TABLE"(and other "SHOW" Statements) with ODBC driver in my Visual
FoxPro application, my application crashed. And the same thing came up in Microsft Visual
Basic application. I could not conclude whether associate it with the Bug#35880.
    But if I start the MySQL Server 5.0, I would succeed.

    How to repeat:
1. Start MySQL server(version 6.0.4).
2. Start Visual Basic 6.0 and create a new standard EXE project.
3. Add a reference of "Microsoft ActiveX Data Objects 2.x Library" to the project. 
4. Draw a button named "Command1" on the form. 
5. Double click the button "Command1" and paste following code to overwrite it's click
event routine:
      Private Sub Command1_Click()
         Dim conn As ADODB.Connection
         Dim rs As ADODB.Recordset
         Dim rsfield As ADODB.Field
         Dim strResult As String
   
         'Connect to MySQL server using MySQL ODBC 5.1.3 Driver
         Set conn = New ADODB.Connection
         conn.ConnectionString = "DRIVER={MySQL ODBC 5.1
Driver};SERVER=localhost;DATABASE=yourDB;UID=user;PWD=password;OPTION=3"
         conn.Open
         'Excute statement
         Set rs = conn.Execute("SHOW CREATE TABLE yourTable")
         For Each rsfield In rs.Fields
             strResult = strResult & rsfield.Name & ":   " & rsfield.Value & vbCrLf
         Next
         conn.Close
         MsgBox strResult
      End Sub
6. Press the key F5 to start debugging the project. Click the button "Command1", now
Microsoft Visual Basic would crash.
[14 May 2008 2:46] Jim Winstead
This is probably a problem of the server returning data using character sets (like the new
4-byte UTF-8) that the client does not understand. Recompiling the driver with the client
library from MySQL 6.0 should help.