16
I'm running into a problem with MySQL where I have the following error.
MySqlClient.MySqlException: Fatal error encountered during command execution. --->
MySql.Data.MySqlClient.MySqlException: Fatal error encountered attempting to read the resultset. --->
MySql.Data.MySqlClient.MySqlException: Reading from the stream has failed. --->
System.IO.EndOfStreamException: Attempted to read past the end of the stream.
This error occurs when I have this running overnight. And it happens infrequently, so it is hard to track down WHY it's happening. I am using .NET 3.5 with MySQLConnector 6.2.4.0.
I am running it using the following code.
public DataSet Read(String query, List<KeyValuePair<String, object>> parameters)
{
MySqlDataAdapter adapter = null;
DataSet returnVal = null;
if (query != null && query.Length > 0)
{
try
{
returnVal = new DataSet();
if (connection.State != ConnectionState.Open)
{
connection.Open();
}
query = SQLHelper.formatSQL(query);
MySqlCommand command = buildCommand(connection, query, parameters);
Stopwatch stopwatch = new Stopwatch();
command.CommandTimeout = 120;
adapter = new MySqlDataAdapter(command);
log.Debug(adapter.SelectCommand.CommandText);
stopwatch.Start();
adapter.Fill(returnVal);
stopwatch.Stop();
if (stopwatch.ElapsedMilliseconds < 150)
{
log.Debug(stopwatch.ElapsedMilliseconds + "ms to run query");
}
else
{
StringBuilder sb = new StringBuilder("");
if (parameters != null)
{