Re: .Read() causes "Connection unexpectedly terminated"
Posted by: paul c
Date: December 10, 2006 12:12PM

1) Having the same problem using Version 1.0.8 RC of MySql Connector 1.0
It happens at .Read() statement after 1000 records.

Works for low transaction rates. You push it and it breaks even if I set
COMPRESS=FALSE in connect string. Too scary to port my MS SQL Sever app until I resolve these issues.


2) Here's the pseudo code;
rdr = MySqlHelper.ExecuteReader(connString, sql);
rownum = 0;
while (rdr.Read()) //Line 215 from the error message belw
{
rownum++;

//Do a simple Update one field update statement like
// update products set disabled=1 where id=55656
//MySqlHelper.ExecuteNonQuery(ConnString, sql, paramArray);
//
if ((rownum % 100) == 0)
{
Thread.Sleep(threadSleep); //try not to tax the db with queries. sleep for 25 millseconds

}

} //End While



3)Here's the connection string
<add key="ConnString" value="Data Source=localhost;User Id=root; Password=password; Database=northwind; pooling=true; Connect Timeout=900" />


Here's the error I get.


Unhandled Exception: MySql.Data.MySqlClient.MySqlException: Connection unexpecte
dly terminated ---> MySql.Data.MySqlClient.MySqlException: Connection unexpected
ly terminated
at MySql.Data.MySqlClient.PacketReader.Read(Byte[]& buffer, Int64 pos, Int64
len) in C:\vs\MySql Connector 1.0\mysqlclient\PacketReader.cs:line 225
--- End of inner exception stack trace ---
at MySql.Data.MySqlClient.PacketReader.Read(Byte[]& buffer, Int64 pos, Int64
len) in C:\vs\MySql Connector 1.0\mysqlclient\PacketReader.cs:line 238
at MySql.Data.MySqlClient.PacketReader.ReadString(Int64 length) in C:\vs\MySq
l Connector 1.0\mysqlclient\PacketReader.cs:line 296
at MySql.Data.Types.MySqlInt32.ReadValue(PacketReader reader, Int64 length) i
n C:\vs\MySql Connector 1.0\mysqlclient\Types\MySqlInt32.cs:line 78
at MySql.Data.MySqlClient.NativeDriver.ReadFieldValue(Int32 index, MySqlField
field, MySqlValue valObject) in C:\vs\MySql Connector 1.0\mysqlclient\nativedri
ver.cs:line 483
at MySql.Data.MySqlClient.CommandResult.ReadDataRow(Boolean loadFields) in C:
\vs\MySql Connector 1.0\mysqlclient\CommandResult.cs:line 200
at MySql.Data.MySqlClient.MySqlDataReader.Read() in C:\vs\MySql Connector 1.0
\mysqlclient\datareader.cs:line 742
at Test.CommandLine.UpdateProductTable() in C:\vs\TestMySql\Loader\M
ain.cs:line 215
at Test.CommandLine.Main(String[] args) in C:\vs\TestMySql\Loader\Ma
in.cs:line 66



Edited 1 time(s). Last edit at 12/10/2006 12:16PM by paul c.

Options: ReplyQuote


Subject
Written By
Posted
Re: .Read() causes "Connection unexpectedly terminated"
December 10, 2006 12:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.