Bug 8507 - Ubuntu - MySqlConnection.Open resulting in System.OverflowException
Summary: Ubuntu - MySqlConnection.Open resulting in System.OverflowException
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-11-19 14:42 UTC by rehcra
Modified: 2012-11-24 05:23 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description rehcra 2012-11-19 14:42:06 UTC
In trying to get the demo from http://www.mono-project.com/MySQL, I tested the following code on: 

Ubuntu 11.10, Mono 2.10.5, Mysql Connector/Net 6.6
Ubuntu 12.04.1 LTS, Mono 3.0.1, Mysql Connector/Net 6.6

Installed MySQL v2 drivers (after renaming) to the gac. Added provider a line to the machine.config.

Testing a Hello World demo compiles and runs fine. The following code executes and connects on MSVS.

The compile cmd works: mcs TestMysqlConnect.cs -r:System.Data.dll -r:/home/steve/MONO/Assemblies/Mysql/v2/MySql.Data.dll

using System;
using System.Data;
using MySql.Data.MySqlClient;

public class Test
{
   public static void Main(string[] args)
   {
      string connectionString =
      "Server=192.168.111.4;" +
      "Database=LOADTRACKER;" +
      "Port=3306;" +
      "User ID=oec;" +
      "Password=oec;" +
      "Pooling=false";

    Console.WriteLine("Create MySqlConnection");

   IDbConnection dbcon;
   dbcon = new MySqlConnection(connectionString);

    Console.WriteLine("dbcon.Open();");

   dbcon.Open();

   IDbCommand dbcmd = dbcon.CreateCommand();

    Console.WriteLine("dbcon.CreateCommand();");

   // requires a table to be created named employee
   // with columns firstname and lastname
   // such as,
   //        CREATE TABLE employee (
   //           firstname varchar(32),
   //           lastname varchar(32));
   string sql =
       "SELECT Account, Security " +
       "FROM accesslist";
   dbcmd.CommandText = sql;
   IDataReader reader = dbcmd.ExecuteReader();
   while(reader.Read()) {
        string acct = (string) reader["Account"];
        string sec = (string) reader["Security"];

        Console.WriteLine("Acct: " + acct + " (" + sec + ")");
   }
   // clean up
   reader.Close();
   reader = null;
   dbcmd.Dispose();
   dbcmd = null;
   dbcon.Close();
   dbcon = null;
   }
}

Executing this code produces:

$mono ./TestMysqlConnect.exe
Create MySqlConnection
dbcon.Open();

Unhandled Exception: System.OverflowException: Number overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific (intptr,int)
  at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.HandleAuthChange (MySql.Data.MySqlClient.MySqlPacket packet) [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate (Boolean reset) [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.NativeDriver.Authenticate (System.String authMethod, Boolean reset) [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.Driver.Open () [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.OverflowException: Number overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific (intptr,int)
  at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.HandleAuthChange (MySql.Data.MySqlClient.MySqlPacket packet) [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate (Boolean reset) [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.NativeDriver.Authenticate (System.String authMethod, Boolean reset) [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.Driver.Open () [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] in <filename unknown>:0
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000] in <filename unknown>:0

Interestingly, if I provide a bad user/password, I get the expected exception of:

[ERROR] FATAL UNHANDLED EXCEPTION: MySql.Data.MySqlClient.MySqlException: Authentication to host '192.168.111.4' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'linux' (using password: YES) ---> MySql.Data.MySqlClient.MySqlException: Access denied for user 'root'@'linux' (using password: YES)

I posted this to StackExchange (http://stackoverflow.com/questions/13349039/mono-on-ubuntu-mysqlconnection-open-resulting-in-system-overflowexception), and the only response, suggested I file a bug report here.

Thank you.
Comment 1 Zoltan Varga 2012-11-24 05:23:42 UTC
-> sys.data.

Note You need to log in before you can comment on or make changes to this bug.