[Mono-dev] Problems connecting to a mysqlserver

Werner666 wernerlangenhuisen at gmail.com
Tue Jul 15 18:50:52 EDT 2008


Hello,

I'm trying to connect to a mysql server that's hosted on my computer. 
When I run the conn.Open(); method I get a Connection unexpectedly
terminated exception.

The complete stack:

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to
handle the exception.
MySql.Data.MySqlClient.MySqlException: Connection unexpectedly terminated
  at MySql.Data.MySqlClient.PacketReader.ReadHeader () [0x00000] 
  at MySql.Data.MySqlClient.PacketReader.OpenPacket () [0x00000] 
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] 
  at MySql.Data.MySqlClient.Driver.Create
(MySql.Data.MySqlClient.MySqlConnectionString settings) [0x00000] 
  at MySql.Data.MySqlClient.MySqlConnection.Open () [0x00000] 
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e,
Boolean is_terminal)
   at GLib.Signal.voidObjectCallback(IntPtr handle, IntPtr data)
   at GLib.Signal.voidObjectCallback(IntPtr , IntPtr )
   at Gtk.Application.gtk_main()
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at CustomerAdministartor.MainClass.Main(System.String[] args) in
/home/werner/testprog/CustomerAdministartor/Main.cs:line 19


With this code:


--------------------------------------------
private IDbConnection dbcon;

connectionString =
	          "Server=" + host + ";" + 
	          "Database=" + dbname + ";" + 
	          "User ID=" + username + ";" +
	          "Password=" + password + ";" + 
	          "Pooling=" + pooling + ";" + 
			  "Connection Timeout=1000;Protocol=socket;Port=3306";
			
			dbcon = new MySqlConnection(connectionString);
			
			dbcon.Open();
----------------------------------------------

I spent my whole day finding a solution but just can't figure it out. :(
I tried version 5.1, 5.1 and 1.0.10 of mysql.data but all of them give the
same exception.

-- 
View this message in context: http://www.nabble.com/Problems-connecting-to-a-mysqlserver-tp18475994p18475994.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list