Bug #12771 Connector/Net can't connect to MySQL 4.1.14-nt
Submitted: 24 Aug 2005 0:11 Modified: 30 Aug 2005 4:18
Reporter: Markus Popp Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:1.0.4 OS:Windows (Windows)
Assigned to: Reggie Burnett CPU Architecture:Any

[24 Aug 2005 0:11] Markus Popp
Description:
After updating from MySQL 4.1.13-nt to 4.1.14-nt, I haven't been able to connect to the server anymore using MySQL Connector/Net 1.0.4. Connecting using MySQL client, JDBC and PHP works without any problems. Operating system is Windows XP SP 1.

How to repeat:
using System;
using MySql.Data.MySqlClient;

namespace test
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			string constring = "Data Source=localhost;User Id=user;" +
				"Password=password;Database=database";

			MySqlConnection con = new MySqlConnection(constring);

			try 
			{
				con.Open();

				Console.WriteLine("Connection established!");

			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.ToString());
			}
			finally
			{
				con.Close();
			}

			Console.ReadLine();
		}
	}
}

produces error message

System.InvalidCastException: Die angegebene Umwandlung ist ungültig.
   at System.Convert.ToInt64(Object value)
   at MySql.Data.MySqlClient.NativeDriver.Configure(MySqlConnection connection)
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at test.Class1.Main(String[] args) in d:\visual studio projects\archiv\test\class1.cs:line 18

If I change the connection string to other servers using other versions, it works.
[24 Aug 2005 7:13] Vasily Kishkin
Thanks for bug report. I was able to reproduce the bug on MySQL 4.1.14:

Unhandled Exception: System.InvalidCastException: Specified cast is not valid.
   at System.Convert.ToInt64(Object value)
   at MySql.Data.MySqlClient.NativeDriver.Configure(MySqlConnection connection)
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at ConsoleApplication1.Class1.Main(String[] args) in d:\store odbc files\12771\class1.cs:line 28
[24 Aug 2005 15:13] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

This appears to be fixed in 1.0.5
[24 Aug 2005 15:25] Markus Popp
Thank you for fixing this bug so quickly!

Do you have the fixed .dll file for .NET 1.1 available and could you attach it to this bug report? That would be great. Thank you!

Markus
[30 Aug 2005 4:18] Mike Hillyer
Added to 1.0.5 changelog: 

<listitem><para>&connector_net; could not connect to MySQL 4.1.14. (Bug #12771)</para></listitem>