Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Timeout expired. The timeout period elapsed prior to completion o

537 views
Skip to first unread message

Sachin Surana

unread,
Apr 26, 2005, 1:44:04 AM4/26/05
to
Hi All,

We are using DAAB (Microsoft.ApplicationBlocks.Data) to execute stored
procedure from .NET But at times we get the following exception "Timeout
expired. The timeout period elapsed prior to completion of the operation or
the server is not responding".

Would appreciate immediate help.

Exception Information *********************************************
Exception Type: System.Data.SqlClient.SqlException Errors:
System.Data.SqlClient.SqlErrorCollection Class: 10 LineNumber: 0 Message:
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding. Number: -2 Procedure:
ConnectionRead (recv()). Server: State: 0 Source: .Net SqlClient Data
Provider TargetSite: System.Data.SqlClient.SqlDataReader
ExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior,
Boolean) HelpLink: NULL StackTrace Information
********************************************* at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream) at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(SqlConnection
connection, SqlTransaction transaction, CommandType commandType, String
commandText, SqlParameter[] commandParameters, SqlConnectionOwnership
connectionOwnership) at
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String
connectionString, CommandType commandType, String commandText, SqlParameter[]
commandParameters) at
TCOM.OSS.Providers.SQLProvider.Provider.CallStoredProc(String procedureName,
SqlParameter[]& sqlParameterList)

Mike Epprecht (SQL MVP)

unread,
Apr 26, 2005, 3:25:01 AM4/26/05
to
Hi

Check for blocking. Run sp_who2 to see what process it blocking another one.
Look at "blocks, avoiding" in SQL Server BOL.

Regards
Mike

Sachin Surana

unread,
Apr 26, 2005, 4:52:04 AM4/26/05
to
Hi Mike,

Thanks a lot for the prompt answer. Actually, we are getting this error on
production and at times when no other heavy process is running.

Could it be because of the 'Timeout' settings in DAAB not working properly
or DAAB not handling connection management properly.

Thanks & Best Regards,
Sachin

Yogesh Dave

unread,
May 5, 2005, 12:58:29 PM5/5/05
to

We have the same problem? Did you find solution to it?
thanks,

*** Sent via Developersdex http://www.developersdex.com ***

MBeaudreau

unread,
May 12, 2005, 8:43:34 AM5/12/05
to

I am having the same issue with a timeout and sqlHelper. Is there a way
to set the timeout time within a sqlHelper property or method?

thanks.
-MJ

Sachin Surana wrote:
> *Hi All,

> SqlParameter[]& sqlParameterList) *

--
MBeaudreau
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

MBeaudreau

unread,
May 12, 2005, 9:50:38 AM5/12/05
to

Does anyone know how to modify SqlHelper.cs ExecuteNonQuery to extend
the timeout? I have a sql stored procedure that runs without output
params but is timing out.

Any help is greatly appreciated.
thanks,
-MJ

Sachin Surana wrote:
> *Hi All,

Sachin Surana

unread,
May 12, 2005, 11:40:01 AM5/12/05
to
The property can be set through CommandTimeout property of SqlCommand. Do
this in the method 'PrepareCommand' of DAAB.

Cheers,
Sachin

rabail satti

unread,
Feb 21, 2007, 2:01:58 AM2/21/07
to
Hello everyone...
plzz help me,im getting this error whenever i want to connect my pc with
another remote pc which i've designated as Server and my database is saved
there so i want to connect my pc with tht remote pc and save data entered by
my pc to that remote pc's database...
but i get this error....PLEASE HELP IMMEDIATELY...

Timeout expired. The timeout period elapsed prior to completion of the

operation or the server is not responding. (.Net SqlClient Data Provider)

----------------------------------------
For help, click: http://go.microsoft.com/fwlink?
ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476

----------------------------------------
Error Number: -2
Severity: 11
State: 0


----------------------------------------
Program Location:

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.
ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner,
Boolean& failoverDemandDone, String host, String failoverPartner, String
protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean
encrypt, Boolean integratedSecurity, SqlConnection owningObject, Boolean
aliasLookup)
at System.Data.SqlClient.SqlInternalConnectionTds.
OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString
connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..
ctor(SqlConnectionString connectionOptions, Object providerInfo, String
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.
CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.
CreateNonPooledConnection(DbConnection owningConnection,
DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.
GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.
OpenConnection(DbConnection outerConnection, DbConnectionFactory
connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.
ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.
ConnectionThreadUser()

Arun Manickam

unread,
Sep 4, 2007, 7:41:53 AM9/4/07
to
Hi

The following code will connect the sql adapter and sql command, applying
this will solve the timeout exception

DbConn.Open()
Dim DbCmd As New SqlClient.SqlDataAdapter
Dim cmd As New SqlCommand(sSQL, DbConn)
cmd.CommandTimeout = 250
DbCmd.SelectCommand = cmd
Dim Dt As New DataTable
DbCmd.Fill(Dt)
DbConn.Close()
Return Dt

Same logic can be applied to oledb command also

Dim DbCmd As New OleDb.OleDbDataAdapter
Dim cmd As New OleDb.OleDbCommand(sSQL, OraConn)
cmd.CommandTimeout = 250
DbCmd.SelectCommand = cmd
Dim Dt As New DataTable
DbCmd.Fill(Dt)
DbConn.Close()
Return Dt

Happy Programming

vvveee

unread,
Sep 26, 2007, 4:19:13 AM9/26/07
to
SqlConnection EDCConnectionString = new SqlConnection(”ConnectionString”);
EDCConnectionString.Open();
string SQLTesterStats = “StoredProcedure”;
SqlCommand cmdTesterStats = new SqlCommand(SQLTesterStats, EDCConnectionString);
cmdTesterStats.CommandType = CommandType.StoredProcedure;
cmdTesterStats.Parameters.AddWithValue(”@start”, “04-01-2007 00:00″);
cmdTesterStats.CommandTimeout = 500000;
SqlDataReader TesterStatsReader = cmdTesterStats.ExecuteReader();
DataRow NewRow;
while (TesterStatsReader.Read())
{
NewRow[”product”] = TesterStatsReader[”family_name”].ToString();
}
TesterStatsReader.Close();
EDCConnectionString.Close();


if u r not having any parameters then set to ''.

hemant

unread,
Jul 10, 2008, 7:08:59 AM7/10/08
to
Hey, I am also getting the same timeout error while using executeNonQuery
method? does anyone get any solution for the same?

url:http://www.ureader.com/msg/1141124.aspx

Linchi Shea

unread,
Jul 10, 2008, 8:10:00 AM7/10/08
to
Query timeout can be caused by so many different root causes. You really have
to find out why your particular query was taking longer than the timeout
threshold by looking at such things as wehther there was blocking, I/O
stalls, wrong plans, etc on a case by case basis. Just saying that you got a
query timeout is not enough for troubleshooting.

Linchi

sreedhar

unread,
Oct 27, 2009, 4:20:53 PM10/27/09
to
what is the solution.please explain me.

url:http://www.ureader.com/msg/1141124.aspx

Erland Sommarskog

unread,
Oct 27, 2009, 6:37:06 PM10/27/09
to
sreedhar (sreedh...@ureader.com) writes:
> what is the solution.please explain me.

If you get Timeout Expired when you connect, the reason may not be the
same as for the previous poster. Often this is caused by network issues.

If you want better answer, you need to provide more details first.


--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

0 new messages