Connection Unexpectedly Terminated!
I am having a strange problem with the MySQL Connector .NET 1.0.6. I am trying to develop a .NET (Version 1.1 SP1) application on a Windows 2000
Professional machine with MySQL Server 4.1.14 version.
A huge amount of SQL query does execute for about 40 minutes but then cancels with the exception "Connection unexpectedly terminated".
I don't know waht is wrong in this
Please provide some views regarding this
Re: Connection Unexpectedly Terminated!
try
{
// Edit connection settings here!
MySqlConnection conn = new MySqlConnection( "server=localhost;user
id=xxx;password=yyy;database=zzz;port=3306" );
conn.Open();
// Do a SELECT on a table with many rows here!
MySqlCommand cmd = new MySqlCommand( "SELECT * FROM xyz LIMIT 1000", conn
);
MySqlDataReader reader = cmd.ExecuteReader();
while ( reader.Read() )
{
// Let's sleep for a moment. Important for reproducing the bug!
Thread.Sleep( 2400 );
}
MessageBox.Show( this, "Done" );
}
catch( Exception ex )
{
MessageBox.Show( this, ex.Message, "Exception!", MessageBoxButtons.OK,
MessageBoxIcon.Error );
}
Since the bug seems to be strongly connected to some timeout, I've tried to
manipulate several server variables which are related to timeout settings.
Re: Connection Unexpectedly Terminated!
Could you post your connectionstring?
Wich version of the Mysql .Net connector are you using?
Do you get this error always? Can you make an connection by using server explorer and create a new dataconnection?
Re: Connection Unexpectedly Terminated!
Stack Trace:
[HttpException (0x80004005): Request timed out.]
i have set the connection string with connect timeout 3000.
surely it shold not take that long
Re: Connection Unexpectedly Terminated!
Are you sure you can access that database? Can you access it by some other tool?
Have you checked that your connecting at the right port? Is there a firewall between?
I have installed one of the 5.x.x mysql connectors for .Net and i can make a connection from Server Control
(New connection, and then change type to mysql)
Have you tried installing a new version of mysql connector?