Home  |  Linux  | Mysql  | PHP  | XML
Deprecated: Function ereg() is deprecated in /rscs/rs/websites/lmpx.com/code/nav/common.inc on line 99
Deprecated: Function ereg() is deprecated in /rscs/rs/websites/lmpx.com/code/nav/common.inc on line 82
From:fr.deboffles@gmail.com Date:Tue Jul 22 01:01:12 2008
Subject:ExecuteReader hangs and goes 100%CPU when the network cable is
unplugged
Hi,
I am making a query using a stored procedure to our Sybase server. The
query I am using can take up to an hour to process before returning
the reader (I have no means to change the server behaviors). If I
unplugged the network cable on my computer while I am in a
ExecuteReader statement the processor goes 100%CPU and the program
hangs. It will only stop when the CommandTimeout occurs (meaning in
the worst case one hour after the event).
I was expecting receiving an exception for the drop of connection.
Can anyone help me ?

I am using Sybase ADO.Net 1.15.50.0 on Windows XP sp2 with
VisualStudio 2005 and .Net 3.5

Here is the code I use to do that:
IDbConnection db_conn = new AseConnection();
db_conn.ConnectionString = "DataSource='172.26.32.15';" +
"Port='5000';" +
"UID='user';" +
"PWD='pass';" +
"ApplicationName='" +
System.Windows.Forms.Application.ProductName + "';" +
"ClientHostName='" + System.Environment.UserName + "';" +
"ClientHostProc='" + System.Environment.UserName + "-" +
System.Windows.Forms.Application.ProductName + "';" +
"EnableServerPacketSize=1;";
try
{
// Open the connection
db_conn.Open();
}
catch (AseException ex)
{
// Handle AseException
}

IDbCommand db_cmd = db_conn.CreateCommand();
db_cmd.CommandText = "my_sp";
IDbDataParameter param = dbCmd.CreateParameter();
param.ParameterName = "@customerid";
param.DbType = DbType.Int32;
param.Value = Convert.ToInt32(1);
db_cmd.Parameters.Add(param);

db_cmd.CommandTimeout = 3600; //1 hour
IDataReader rdr = null;
if (db_conn.State == ConnectionState.Open)
{
try
{
// If I unplug the network cable while executing this line
the CPU goes 100% until the timeout trigger
rdr =
db_cmd.ExecuteReader(CommandBehavior.SequentialAccess);
}
catch (AseException ex)
{
// Handle AseException
}
}
...
...

Thanks,
Navigate in group sybase.public.connectivity.adonet at sever forums.sybase.com
Previous Next


Your recent visits
PRINT statements in SQL and SQLDataReader
Re: How to use connection.GetSchema()?
Re: Are MO5.7 working on Windows Mobile6.5
Re: migration from pb10.5 to pb11.1 winform - webservice errors
Re: SybSQLException: RAISERROR There is no object with the specifiedowner/name combination



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants