Showing posts with label timeout. Show all posts
Showing posts with label timeout. Show all posts

Wednesday, March 7, 2012

Connection timeout/ODBC failed

Dear All,
I am working on a VBA (MS Access) application, which connects Remote
SQL Server by ODBC Connection. When I open this application on my
workstation the error "Connection timeout' or "ODBC - failed"
will occur, But when I open it on the remote desktop it will run.
Can you suggest me what is going wrong.
Regards,
ShitalPerhaps you are blocked by port or by IP address. Typically, SQL Server
inside a network is not exposed to the outside world directly unless it
needs to be.
Can you connect to the remote SQL Server using Enterprise Manager or Query
Analyzer?
"rock" <khandar@.gmail.com> wrote in message
news:1150108297.418689.286870@.y43g2000cwc.googlegroups.com...
> Dear All,
> I am working on a VBA (MS Access) application, which connects Remote
> SQL Server by ODBC Connection. When I open this application on my
> workstation the error "Connection timeout' or "ODBC - failed"
> will occur, But when I open it on the remote desktop it will run.
> Can you suggest me what is going wrong.
> Regards,
> Shital
>

Connection timeout when using transactions

I'm getting a timeout error while trying to select data from SQL server
2005 after opening a transaction in asn asp.net application.
It goes like this:
SqlConnection conn1 = new SqlConnection(...);
conn1.Open();
SqlTransaction trans = conn1.Open();
// do some inserts and updates using the transaction
SqlConnection conn2 = new SqlConnection(...);
conn2.Open();
// select using conn2 and decide what to do
conn2.Close();
// do more inserts and updates based on that decision
trans.Commit();
conn1.Commit();
It probably has something to do with the connection pool returning the
already open conn1 to connection2.
In the actual process, the select using the 2nd connection is being
opened in another method, and I don't want to overload the method to
receive the transaction.
Is there any other option? Is there any way to really open another
connection, or the connection pool to not return open connections being
used in transactions?
Thanks.Natan Vivo wrote:
> I'm getting a timeout error while trying to select data from SQL server
> 2005 after opening a transaction in asn asp.net application.
> It goes like this:
> SqlConnection conn1 = new SqlConnection(...);
> conn1.Open();
> SqlTransaction trans = conn1.Open();
> // do some inserts and updates using the transaction
> SqlConnection conn2 = new SqlConnection(...);
> conn2.Open();
> // select using conn2 and decide what to do
> conn2.Close();
> // do more inserts and updates based on that decision
> trans.Commit();
> conn1.Commit();
> It probably has something to do with the connection pool returning the
> already open conn1 to connection2.
> In the actual process, the select using the 2nd connection is being
> opened in another method, and I don't want to overload the method to
> receive the transaction.
> Is there any other option? Is there any way to really open another
> connection, or the connection pool to not return open connections being
> used in transactions?
> Thanks.
Have you changed the default CommandTimeout from the default? I think
the default for ASP/ASP.NET is 30 seconds.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Tracy McKibben wrote:
> Have you changed the default CommandTimeout from the default? I think
> the default for ASP/ASP.NET is 30 seconds.
No, and it is not the problem. The whole process takes less than 1 second.
The thing is exactly what I told. If I open an second connection and
select something, while connection one is in transaction, it hangs and
gives me a connection timeout.
Can anyone reproduce this?|||Natan Vivo wrote:
> Tracy McKibben wrote:
>> Have you changed the default CommandTimeout from the default? I think
>> the default for ASP/ASP.NET is 30 seconds.
> No, and it is not the problem. The whole process takes less than 1 second.
> The thing is exactly what I told. If I open an second connection and
> select something, while connection one is in transaction, it hangs and
> gives me a connection timeout.
> Can anyone reproduce this?
Not knowing what selects you're running in connection 2, I'd have to say
you're probably deadlocking against the open transaction in connection 1.
http://realsqlguy.com/twiki/bin/view/RealSQLGuy/SimulatingADeadlock
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Natan Vivo wrote:
> Tracy McKibben wrote:
>> Have you changed the default CommandTimeout from the default? I think
>> the default for ASP/ASP.NET is 30 seconds.
> No, and it is not the problem. The whole process takes less than 1 second.
> The thing is exactly what I told. If I open an second connection and
> select something, while connection one is in transaction, it hangs and
> gives me a connection timeout.
> Can anyone reproduce this?
Yes, I had the exact same problem in an application of mine. In the
absence of finding a solution, I coded around it. Sorry I can't be of
more help, but you're not alone. :)
Neil B|||Natan Vivo wrote:
> I'm getting a timeout error while trying to select data from SQL server
> 2005 after opening a transaction in asn asp.net application.
> It goes like this:
> SqlConnection conn1 = new SqlConnection(...);
> conn1.Open();
> SqlTransaction trans = conn1.Open();
> // do some inserts and updates using the transaction
> SqlConnection conn2 = new SqlConnection(...);
> conn2.Open();
> // select using conn2 and decide what to do
> conn2.Close();
> // do more inserts and updates based on that decision
> trans.Commit();
> conn1.Commit();
> It probably has something to do with the connection pool returning the
> already open conn1 to connection2.
>
No, that's not how the connection pool works. If you have two open
connections in your code, you'll be using two connections from the
connection pool.
> In the actual process, the select using the 2nd connection is being
> opened in another method, and I don't want to overload the method to
> receive the transaction.
> Is there any other option? Is there any way to really open another
> connection, or the connection pool to not return open connections being
> used in transactions?
>From your description, it's almost certainly a deadlock on sql server.
Without seeing the database code, it's going to be difficult to help
you out.
To confirm it's a deadlock, open a connection using query analyser,
start your code running, then run sp_who2. It'll show your second
connection being blocked by your first.
Damien|||Tracy McKibben wrote:
> Natan Vivo wrote:
>> Tracy McKibben wrote:
>> Have you changed the default CommandTimeout from the default? I
>> think the default for ASP/ASP.NET is 30 seconds.
>> No, and it is not the problem. The whole process takes less than 1
>> second.
>> The thing is exactly what I told. If I open an second connection and
>> select something, while connection one is in transaction, it hangs and
>> gives me a connection timeout.
>> Can anyone reproduce this?
> Not knowing what selects you're running in connection 2, I'd have to say
> you're probably deadlocking against the open transaction in connection 1.
> http://realsqlguy.com/twiki/bin/view/RealSQLGuy/SimulatingADeadlock
>
Thanks. It was really a deadlock, the select was selecting data from the
same table I had already update.
It seems I can solve this by using the right IsolationLevel when
begining the transaction.
I'll test it later. Thanks!|||Natan Vivo wrote:
> Thanks. It was really a deadlock, the select was selecting data from the
> same table I had already update.
> It seems I can solve this by using the right IsolationLevel when
> begining the transaction.
> I'll test it later. Thanks!
Be careful that you're not reading "dirty" data, meaning data that is
inconsistent because it's been partially altered by a transaction...
Tracy McKibben
MCDBA
http://www.realsqlguy.com

Connection timeout when using transactions

I'm getting a timeout error while trying to select data from SQL server
2005 after opening a transaction in asn asp.net application.
It goes like this:
SqlConnection conn1 = new SqlConnection(...);
conn1.Open();
SqlTransaction trans = conn1.Open();
// do some inserts and updates using the transaction
SqlConnection conn2 = new SqlConnection(...);
conn2.Open();
// select using conn2 and decide what to do
conn2.Close();
// do more inserts and updates based on that decision
trans.Commit();
conn1.Commit();
It probably has something to do with the connection pool returning the
already open conn1 to connection2.
In the actual process, the select using the 2nd connection is being
opened in another method, and I don't want to overload the method to
receive the transaction.
Is there any other option? Is there any way to really open another
connection, or the connection pool to not return open connections being
used in transactions?
Thanks.Natan Vivo wrote:
> I'm getting a timeout error while trying to select data from SQL server
> 2005 after opening a transaction in asn asp.net application.
> It goes like this:
> SqlConnection conn1 = new SqlConnection(...);
> conn1.Open();
> SqlTransaction trans = conn1.Open();
> // do some inserts and updates using the transaction
> SqlConnection conn2 = new SqlConnection(...);
> conn2.Open();
> // select using conn2 and decide what to do
> conn2.Close();
> // do more inserts and updates based on that decision
> trans.Commit();
> conn1.Commit();
> It probably has something to do with the connection pool returning the
> already open conn1 to connection2.
> In the actual process, the select using the 2nd connection is being
> opened in another method, and I don't want to overload the method to
> receive the transaction.
> Is there any other option? Is there any way to really open another
> connection, or the connection pool to not return open connections being
> used in transactions?
> Thanks.
Have you changed the default CommandTimeout from the default? I think
the default for ASP/ASP.NET is 30 seconds.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Tracy McKibben wrote:
> Have you changed the default CommandTimeout from the default? I think
> the default for ASP/ASP.NET is 30 seconds.
No, and it is not the problem. The whole process takes less than 1 second.
The thing is exactly what I told. If I open an second connection and
select something, while connection one is in transaction, it hangs and
gives me a connection timeout.
Can anyone reproduce this?|||Natan Vivo wrote:
> Tracy McKibben wrote:
> No, and it is not the problem. The whole process takes less than 1 second.
> The thing is exactly what I told. If I open an second connection and
> select something, while connection one is in transaction, it hangs and
> gives me a connection timeout.
> Can anyone reproduce this?
Not knowing what selects you're running in connection 2, I'd have to say
you're probably deadlocking against the open transaction in connection 1.
http://realsqlguy.com/twiki/bin/vie...latingADeadlock
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Natan Vivo wrote:
> Tracy McKibben wrote:
> No, and it is not the problem. The whole process takes less than 1 second.
> The thing is exactly what I told. If I open an second connection and
> select something, while connection one is in transaction, it hangs and
> gives me a connection timeout.
> Can anyone reproduce this?
Yes, I had the exact same problem in an application of mine. In the
absence of finding a solution, I coded around it. Sorry I can't be of
more help, but you're not alone.
Neil B|||Natan Vivo wrote:
> I'm getting a timeout error while trying to select data from SQL server
> 2005 after opening a transaction in asn asp.net application.
> It goes like this:
> SqlConnection conn1 = new SqlConnection(...);
> conn1.Open();
> SqlTransaction trans = conn1.Open();
> // do some inserts and updates using the transaction
> SqlConnection conn2 = new SqlConnection(...);
> conn2.Open();
> // select using conn2 and decide what to do
> conn2.Close();
> // do more inserts and updates based on that decision
> trans.Commit();
> conn1.Commit();
> It probably has something to do with the connection pool returning the
> already open conn1 to connection2.
>
No, that's not how the connection pool works. If you have two open
connections in your code, you'll be using two connections from the
connection pool.

> In the actual process, the select using the 2nd connection is being
> opened in another method, and I don't want to overload the method to
> receive the transaction.
> Is there any other option? Is there any way to really open another
> connection, or the connection pool to not return open connections being
> used in transactions?
>From your description, it's almost certainly a deadlock on sql server.
Without seeing the database code, it's going to be difficult to help
you out.
To confirm it's a deadlock, open a connection using query analyser,
start your code running, then run sp_who2. It'll show your second
connection being blocked by your first.
Damien|||Tracy McKibben wrote:
> Natan Vivo wrote:
> Not knowing what selects you're running in connection 2, I'd have to say
> you're probably deadlocking against the open transaction in connection 1.
> http://realsqlguy.com/twiki/bin/vie...latingADeadlock
>
Thanks. It was really a deadlock, the select was selecting data from the
same table I had already update.
It seems I can solve this by using the right IsolationLevel when
begining the transaction.
I'll test it later. Thanks!|||Natan Vivo wrote:
> Thanks. It was really a deadlock, the select was selecting data from the
> same table I had already update.
> It seems I can solve this by using the right IsolationLevel when
> begining the transaction.
> I'll test it later. Thanks!
Be careful that you're not reading "dirty" data, meaning data that is
inconsistent because it's been partially altered by a transaction...
Tracy McKibben
MCDBA
http://www.realsqlguy.com

Connection Timeout when processing cube

I am getting a connection timeout error when processing a cube with measure group containing 4mil rows or so. It errors after 5 mins and after about 3mil rows have been read so it's probably not the ExternalCommandTimeout issue. The Fact table for the measure group is created using a named query. I would appreciate any insight into why the error is thrown after 5 mins. Here's part of the error:

===================================

The connection was lost. Close all processing dialog boxes and try processing the object again. (Microsoft Visual Studio)

===================================

The connection either timed out or was lost. (Microsoft.AnalysisServices)


Program Location:

at Microsoft.AnalysisServices.XmlaClient.EndRequest()
at Microsoft.AnalysisServices.XmlaClient.SendExecuteAndReadResponse(Boolean skipResults, Boolean throwIfError)
at Microsoft.AnalysisServices.AnalysisServicesClient.Execute(String command)
at Microsoft.AnalysisServices.Server.Execute(String command)
at Microsoft.AnalysisServices.ManagementDialogs.OlapProcessProgressContainer.ProcessObjects()

===================================

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. (System)


Program Location:

at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at Microsoft.AnalysisServices.DimeRecord.ForceRead(Stream stream, Byte[] buffer, Int32 length)
at Microsoft.AnalysisServices.DimeRecord.ReadHeader()
at Microsoft.AnalysisServices.DimeRecord..ctor(Stream stream)
at Microsoft.AnalysisServices.DimeReader.ReadRecord()
at Microsoft.AnalysisServices.TcpStream.GetDataType()

===================================

An existing connection was forcibly closed by the remote host (System)

Dont think this has anything to do with ExternalCommandTimeout.

Try processing your cube using SQL Management Studio.
For that first deploy your project and in the project's properties in the deployment tab select Processing option = "Do Not Process".
Then open a SQL Management studio, connect to Analysis Services, navigate to your cube and try to process it. See if you get any errors.

Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||I already tried processing inside SQL Management Studio but got the same error. I also ran the named query inside SQL Management Studio and it took about 10 mins to return all 4mil rows so I know the named query should be good too...... |||

Couplde of things:

Take a look at the msmdsrv.log located in C:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\Log folder.
Do you see there any messages around time you trying to process your cube.

If you havent yet, install SP1 of SQL Server and see if the same behavior persists.

Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||Fixed. It was due to networking issues in the office. Thanks guys!

Connection Timeout when processing cube

I am getting a connection timeout error when processing a cube with measure group containing 4mil rows or so. It errors after 5 mins and after about 3mil rows have been read so it's probably not the ExternalCommandTimeout issue. The Fact table for the measure group is created using a named query. I would appreciate any insight into why the error is thrown after 5 mins. Here's part of the error:

===================================

The connection was lost. Close all processing dialog boxes and try processing the object again. (Microsoft Visual Studio)

===================================

The connection either timed out or was lost. (Microsoft.AnalysisServices)


Program Location:

at Microsoft.AnalysisServices.XmlaClient.EndRequest()
at Microsoft.AnalysisServices.XmlaClient.SendExecuteAndReadResponse(Boolean skipResults, Boolean throwIfError)
at Microsoft.AnalysisServices.AnalysisServicesClient.Execute(String command)
at Microsoft.AnalysisServices.Server.Execute(String command)
at Microsoft.AnalysisServices.ManagementDialogs.OlapProcessProgressContainer.ProcessObjects()

===================================

Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. (System)


Program Location:

at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at Microsoft.AnalysisServices.DimeRecord.ForceRead(Stream stream, Byte[] buffer, Int32 length)
at Microsoft.AnalysisServices.DimeRecord.ReadHeader()
at Microsoft.AnalysisServices.DimeRecord..ctor(Stream stream)
at Microsoft.AnalysisServices.DimeReader.ReadRecord()
at Microsoft.AnalysisServices.TcpStream.GetDataType()

===================================

An existing connection was forcibly closed by the remote host (System)

Dont think this has anything to do with ExternalCommandTimeout.

Try processing your cube using SQL Management Studio.
For that first deploy your project and in the project's properties in the deployment tab select Processing option = "Do Not Process".
Then open a SQL Management studio, connect to Analysis Services, navigate to your cube and try to process it. See if you get any errors.

Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||I already tried processing inside SQL Management Studio but got the same error. I also ran the named query inside SQL Management Studio and it took about 10 mins to return all 4mil rows so I know the named query should be good too...... |||

Couplde of things:

Take a look at the msmdsrv.log located in C:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\Log folder.
Do you see there any messages around time you trying to process your cube.

If you havent yet, install SP1 of SQL Server and see if the same behavior persists.

Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||Fixed. It was due to networking issues in the office. Thanks guys!

Connection timeout when generating recordset from a stored procedure in an ASP page

I'm trying to create a binding to a stored procedure on a SQL server. I can
create the database connection and view the tables and stored procedures.
When I try to create a stored procedure binding I can choose the connection
and the procedure. But when I check "Returns DataSet" and click Test... I
get the following Dreamweaver error after a minute or so:
A server timeout has occured. Here are the possible reasons.
1. Please make sure that the webserver is up and running.
2. Please verify that the ODBC DSN exists on the testing server.
Executing the stored procedure in SQL Query Analyzer returns results in less
than 5 seconds.
My webserver is up and running and the web.config file is the same on both
the local machine and testing server. The SQL server and webserver are
different machines. My stored procedure is below.
I can create datasets (querys) on the database tables. It's only when I try
to generate a dataset from a stored procedure that run into problems.
If it matters I'm using ASP.NET VB, SQL Server 2000, IIS 5.0, .NET 1.1 and
Dreamweaver MX 2004.
Please help, I'm at a standstill.
I get the same problem when using VB .NET to to create the ASP page. If I
use Coldfusion instead on ASP it works flawlessly. Only problem is I that
have a developers license for Coldfusion so this is not an acceptable
workaround.
Thanks in advance!! My stored procedure is below:
CREATE PROCEDURE proc_combinedDB
(@.platform varchar(40), @.server varchar(40),@.keyword varchar(50))
WITH RECOMPILE
AS
SELECT *
FROM [prtracker_classworks].[dbo].[Problem Reports]
WHERE [Workstation OS] LIKE @.platform AND [Server OS] LIKE @.server A
ND
Details LIKE @.keyword
UNION ALL
SELECT *
FROM [prtracker_mac bugs].[dbo].[Problem Reports]
WHERE [Workstation OS] LIKE @.platform AND [Server OS]
LIKE @.server AND Details LIKE @.keyword
UNION ALL
SELECT *
FROM [Prtracker_Arizona State Edition].[dbo].[Problem Re
ports]
WHERE [Workstation OS] LIKE @.platform AND [Server OS] LIKE @.server A
ND
Details LIKE @.keyword
... // And so on for 15 more databases
RETURN
GOHi,
I am getting the same error using DWMX 2004 / ASP / VB.
Did you found a workaround ?
If so, your help is greatly apreciated.
axiaxi2003@.hotmail.com
A
amucino
---
Posted via http://www.mcse.ms
---
View this thread: http://www.mcse.ms/message466748.html

Connection TimeOut seems not working properly

Hi all,

I use SqlHelper to connect to database. I need to set a timeout to execute some sp because I don′t want to wait for this sp if it make me wait a lot. So I set the Connection TimeOut every time I execute a sp. But this seems not working properly. I set this value to 5 and I execute a sp than runs in 15 but It waits for it.

Any idea

Best regards

www.ITCubo.net

SqlCommands and SqlConnections both have timeout parameters. Maybe one of their values is interfering with what you want.

Connection Timeout Problems

Hi,
We want to connect to a remote SQL server to retrieve stock levels in real
time. If the SQL server is unavailable (it is not on a totally reliable
network connection) we want to display stock levels from a local backup
database. So, if we can't connect to the remote server in say 5 seconds, we
want the connection attempt to time out and return control to our
application (a web application on windows 2000 written in ASP). I cannot get
the connection attempt to timeout if the remote server is unavailable. I
have tried:
- Setting the ConnectionTimeout on the ADO connection object. As far as I
can see, if the server is totally unavailable, setting the Timeout property
has no effect at all
and
- Writing a VB component which opens the connection asynchronously and polls
to see whether it has opened successfully. This sort of works, except that
if I try to cancel the attempt to open the connection, this hangs for about
30 seconds before returning control to my component.
The connection string I am using is: "provider=sqloledb;Server=<Server IP
Address>;Initial Catalog=<DBName>;user Id=<userid>;Password=<password>
Is there any reliable way of setting a connection timeout for this
situation?
Thanks,
Peter
Hi Pete,
The loginTimeout issue is due to the underlying networking components.
So, before we send the login packet for SQL, we first have to establish an
underlying tcp session. (3 way handshake). If this doesn't complete, the
LoginTimeout is never even used. You may be able to reduce the timeout by
adjusting the tcp settings.
See the following kb;
176257 PRB: Client Login Does Not Time Out If the Server Is Offline
http://support.microsoft.com/?id=176257
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Connection Timeout Problems

Hi,
We want to connect to a remote SQL server to retrieve stock levels in real
time. If the SQL server is unavailable (it is not on a totally reliable
network connection) we want to display stock levels from a local backup
database. So, if we can't connect to the remote server in say 5 seconds, we
want the connection attempt to time out and return control to our
application (a web application on Windows 2000 written in ASP). I cannot get
the connection attempt to timeout if the remote server is unavailable. I
have tried:
- Setting the ConnectionTimeout on the ADO connection object. As far as I
can see, if the server is totally unavailable, setting the Timeout property
has no effect at all
and
- Writing a VB component which opens the connection asynchronously and polls
to see whether it has opened successfully. This sort of works, except that
if I try to cancel the attempt to open the connection, this hangs for about
30 seconds before returning control to my component.
The connection string I am using is: "provider=sqloledb;Server=<Server IP
Address>;Initial Catalog=<DBName>;user Id=<userid>;Password=<password>
Is there any reliable way of setting a connection timeout for this
situation?
Thanks,
PeterHi Pete,
The loginTimeout issue is due to the underlying networking components.
So, before we send the login packet for SQL, we first have to establish an
underlying tcp session. (3 way handshake). If this doesn't complete, the
LoginTimeout is never even used. You may be able to reduce the timeout by
adjusting the tcp settings.
See the following kb;
176257 PRB: Client Login Does Not Time Out If the Server Is Offline
http://support.microsoft.com/?id=176257
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Connection timeout problem

Hi
Using ado/ole-db, I create a connection to a database (SQL 2000) specifying
a time-out value of 43200 (which should equate to 12 hours).
I then create a command and use the active connection and also take the
added precaution (which is probably pointless) of setting the command
timeout value to also be 12 hours.
I then execute some SQL that has been dynamically prepared (and could take
many hours to complete) and run this. However, I get an error in the
Application event log showing that the connection timed-out. This doesn't
happen everytime - most times it connects and runs flawlessly... The error
details for the timeout are:
Err.Number = -214746759
Err.Description = Timeout expired
And this occurs in the region of approximately 1 minute after the code was
initialised (the machine is ultra busy at this time).
I may well be wrong here, but I assume that it wasn't the connection that
timed out (i.e. was made and then was dropped) but that there's a specified
time allowed to make the connection and that it's this allowed time that is
too short - remember, the machine is ultra busy at this time). If I am
right in this assumption then I need a way of telling it not to give up
quite so quickly (or to retry several hundred times). Any insight as to
what might be happening and any suggestions concerning how to fix this would
be most welcome.
I include my code below (error handling and app logging removed for
clarity):
' Declarations
Dim oCmd As ADODB.Command
Dim oCn As ADODB.Connection
Dim lTimeOut As Long
'--
' Set the timeout ( = 43200 seconds = 12 hours)
lTimeOut = CLng(mIni.iniKeyValue(mIni.computerName, "timeOut"))
'--
' Create a new connection to the database
Set oCn = New ADODB.Connection
With oCn
.ConnectionString = mIni.iniKeyValue(computerName,
"connectionString")
.CommandTimeout = lTimeOut
.Open
End With
'--
' Instantiate the command object
Set oCmd = New ADODB.Command
With oCmd
'--
Set .ActiveConnection = oCn
.CommandType = adCmdText
.CommandText = sSQL
.CommandTimeout = lTimeOut
'--
' Execute the SQL
.Execute
'--
' Disconnect command
Set .ActiveConnection = Nothing
'--
End With
'--
' Trash the command and connection objects
oCn.Close
Set oCn = Nothing
Set oCmd = Nothing
'--
Many thanks in advance
GriffHi GriffithsJ, try using CommandTimeout = 0.
Vctor Koch From Argentina.
"GriffithsJ" <GriffithsJ_520@.hotmail.com> escribi en el mensaje
news:uzXSsXp2DHA.2060@.TK2MSFTNGP10.phx.gbl...
quote:

> Hi
> Using ado/ole-db, I create a connection to a database (SQL 2000)

specifying
quote:

> a time-out value of 43200 (which should equate to 12 hours).
> I then create a command and use the active connection and also take the
> added precaution (which is probably pointless) of setting the command
> timeout value to also be 12 hours.
> I then execute some SQL that has been dynamically prepared (and could take
> many hours to complete) and run this. However, I get an error in the
> Application event log showing that the connection timed-out. This doesn't
> happen everytime - most times it connects and runs flawlessly... The

error
quote:

> details for the timeout are:
> Err.Number = -214746759
> Err.Description = Timeout expired
> And this occurs in the region of approximately 1 minute after the code was
> initialised (the machine is ultra busy at this time).
> I may well be wrong here, but I assume that it wasn't the connection that
> timed out (i.e. was made and then was dropped) but that there's a

specified
quote:

> time allowed to make the connection and that it's this allowed time that

is
quote:

> too short - remember, the machine is ultra busy at this time). If I am
> right in this assumption then I need a way of telling it not to give up
> quite so quickly (or to retry several hundred times). Any insight as to
> what might be happening and any suggestions concerning how to fix this

would
quote:

> be most welcome.
> I include my code below (error handling and app logging removed for
> clarity):
> ' Declarations
> Dim oCmd As ADODB.Command
> Dim oCn As ADODB.Connection
> Dim lTimeOut As Long
> '--
> ' Set the timeout ( = 43200 seconds = 12 hours)
> lTimeOut = CLng(mIni.iniKeyValue(mIni.computerName, "timeOut"))
> '--
> ' Create a new connection to the database
> Set oCn = New ADODB.Connection
> With oCn
> .ConnectionString = mIni.iniKeyValue(computerName,
> "connectionString")
> .CommandTimeout = lTimeOut
> .Open
> End With
> '--
> ' Instantiate the command object
> Set oCmd = New ADODB.Command
> With oCmd
> '--
> Set .ActiveConnection = oCn
> .CommandType = adCmdText
> .CommandText = sSQL
> .CommandTimeout = lTimeOut
> '--
> ' Execute the SQL
> .Execute
> '--
> ' Disconnect command
> Set .ActiveConnection = Nothing
> '--
> End With
> '--
> ' Trash the command and connection objects
> oCn.Close
> Set oCn = Nothing
> Set oCmd = Nothing
> '--
> Many thanks in advance
> Griff
>
|||> Hi GriffithsJ, try using CommandTimeout = 0.
quote:

> --

That's the equivalent of saying infinite...
Two things.
First is that I'm always a little cautious about using infinite values, I'd
prefer to set values to very large finite values - that way, server
resources should eventually tidy themselves up.
Second is that I had a commandTimeout value of 12 hours and it died within a
minute. I'm not sure who increasing the commandTimeout value from 12 hours
to infinite would affect it being killed off in under a minute (unless
setting it to 0 has any other special effects I'm not aware of.)
Griff|||Hi Griff,
quote:

> I then create a command and use the active connection and also take the
> added precaution (which is probably pointless) of setting the command
> timeout value to also be 12 hours.

Command.CommandTimeout must be explicitly set as you did.
It is not passed over from the Connection.CommandTimeout
when assigning the Command.ActiveConnection from there.
So the taken precaution is obligatory.
quote:

> I then execute some SQL that has been dynamically prepared (and could take
> many hours to complete) and run this. However, I get an error in the
> Application event log showing that the connection timed-out. This doesn't
> happen everytime - most times it connects and runs flawlessly... The erro
r
> details for the timeout are:

You mean the c o n n e c t i o n times out, not the command, right?
When does it time out - when oCn.Open is executed or where?
If so, increase the ConnectionTimeout of oCn before Open
so that it waits longer to establish the connection:
quote:

> With oCn
> .ConnectionString = mIni.iniKeyValue(computerName,
> "connectionString")
> .CommandTimeout = lTimeOut

.ConnectionTimeout = 300 '****************************
quote:

> .Open

quote:

> End With

However, if you mean that the c o m m a n d times out at oCmd.Execute,
check whether oCmd.CommandTimeout has indeed the intended 43200 at that time
and whether it is really a command timeout or a connection error.
quote:

> Err.Number = -214746759

The error number might be wrong. Could be -2147467259 (the notorious 8000400
5H).
Regards,
Frank
Message sent 14 Jan 2004 15:19:22 GMT|||Hi Frank
Many thanks for that answer...I've made all the necessary changes as you
suggested and have uploaded the compiled code.
Will find out tomorrow morning whether this worked...
Thanks
Griff|||> Using ado/ole-db, I create a connection to a database (SQL 2000)
specifying
quote:

> a time-out value of 43200 (which should equate to 12 hours).
> I then create a command and use the active connection and also take the
> added precaution (which is probably pointless) of setting the command
> timeout value to also be 12 hours.

Comand timeout is seperate from connection timeout.
http://www.devguru.com/Technologies...andtimeout.html
Try the command GUI in a adoanywhere command gui.
http://www.adoanywhere.com/help/command.htm#Command
Mike Collier
http://www.adoanywhere.com
http://www.adoanywhere.com/forum
"GriffithsJ" <GriffithsJ_520@.hotmail.com> wrote in message
news:uzXSsXp2DHA.2060@.TK2MSFTNGP10.phx.gbl...
quote:

> Hi
> Using ado/ole-db, I create a connection to a database (SQL 2000)

specifying
quote:

> a time-out value of 43200 (which should equate to 12 hours).
> I then create a command and use the active connection and also take the
> added precaution (which is probably pointless) of setting the command
> timeout value to also be 12 hours.
> I then execute some SQL that has been dynamically prepared (and could take
> many hours to complete) and run this. However, I get an error in the
> Application event log showing that the connection timed-out. This doesn't
> happen everytime - most times it connects and runs flawlessly... The

error
quote:

> details for the timeout are:
> Err.Number = -214746759
> Err.Description = Timeout expired
> And this occurs in the region of approximately 1 minute after the code was
> initialised (the machine is ultra busy at this time).
> I may well be wrong here, but I assume that it wasn't the connection that
> timed out (i.e. was made and then was dropped) but that there's a

specified
quote:

> time allowed to make the connection and that it's this allowed time that

is
quote:

> too short - remember, the machine is ultra busy at this time). If I am
> right in this assumption then I need a way of telling it not to give up
> quite so quickly (or to retry several hundred times). Any insight as to
> what might be happening and any suggestions concerning how to fix this

would
quote:

> be most welcome.
> I include my code below (error handling and app logging removed for
> clarity):
> ' Declarations
> Dim oCmd As ADODB.Command
> Dim oCn As ADODB.Connection
> Dim lTimeOut As Long
> '--
> ' Set the timeout ( = 43200 seconds = 12 hours)
> lTimeOut = CLng(mIni.iniKeyValue(mIni.computerName, "timeOut"))
> '--
> ' Create a new connection to the database
> Set oCn = New ADODB.Connection
> With oCn
> .ConnectionString = mIni.iniKeyValue(computerName,
> "connectionString")
> .CommandTimeout = lTimeOut
> .Open
> End With
> '--
> ' Instantiate the command object
> Set oCmd = New ADODB.Command
> With oCmd
> '--
> Set .ActiveConnection = oCn
> .CommandType = adCmdText
> .CommandText = sSQL
> .CommandTimeout = lTimeOut
> '--
> ' Execute the SQL
> .Execute
> '--
> ' Disconnect command
> Set .ActiveConnection = Nothing
> '--
> End With
> '--
> ' Trash the command and connection objects
> oCn.Close
> Set oCn = Nothing
> Set oCmd = Nothing
> '--
> Many thanks in advance
> Griff
>

connection timeout exception dialog

Hi,
When I am trying to open Access 2003 report after SQL server is stopped I
am getting following error:
Microsoft SQL Server Login
Connection failed:
SQL Server Error: 53
SQL Server does not exist or access denied.
Our requirement is to supress this error dialog and instead show customized
msg.
Any pointer how to supress error dialog in SQL msde because of connection
failure will be of great help....
Cheers,
Binod
How are you opening the report? One solution to the problem would be
for the users to NOT open the report directly from the UI, but instead
open it by clicking a button on a form. You can then write code that
tests to see if the connection is still active. If it is, you open the
report. If it isn't, display your custom message.
--Mary
On Thu, 30 Dec 2004 04:59:01 -0800, "Abhi poddar"
<Abhipoddar@.discussions.microsoft.com> wrote:

>Hi,
> When I am trying to open Access 2003 report after SQL server is stopped I
>am getting following error:
>---
>Microsoft SQL Server Login
>---
>Connection failed:
>SQL Server Error: 53
>SQL Server does not exist or access denied.
>---
>Our requirement is to supress this error dialog and instead show customized
>msg.
>Any pointer how to supress error dialog in SQL msde because of connection
>failure will be of great help....
>Cheers,
>Binod

Connection timeout dialog

Hi,
When I am trying to open Access 2003 report after SQL server is stopped I
am getting following error:
---
Microsoft SQL Server Login
---
Connection failed:
SQL Server Error: 53
SQL Server does not exist or access denied.
---
Our requirement is to supress this error dialog and instead show customized
msg.
Any pointer how to supress error dialog in SQL msde because of connection
failure will be of great help....
Cheers,
BinodAbhi poddar (Abhipoddar@.discussions.microsoft.com) writes:
> When I am trying to open Access 2003 report after SQL server is
> stopped I am getting following error:
> ---
> Microsoft SQL Server Login
> ---
> Connection failed:
> SQL Server Error: 53
> SQL Server does not exist or access denied.
> ---
> Our requirement is to supress this error dialog and instead show
> customized msg.
> Any pointer how to supress error dialog in SQL msde because of connection
> failure will be of great help....
You would have to trap it with an ON ERROR and the look at the .Errors
collection. Presuming, that is, that you are using ADO. If you use DAO,
I don't have a clue.
In any case, this does not have much to do with SQL Server, but is something
you need to address in Access, so I would recommend asking in an Access
newsgroup.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Connection timeout dialog

Hi,
When I am trying to open Access 2003 report after SQL server is stopped I
am getting following error:
Microsoft SQL Server Login
Connection failed:
SQL Server Error: 53
SQL Server does not exist or access denied.
Our requirement is to supress this error dialog and instead show customized
msg.
Any pointer how to supress error dialog in SQL msde because of connection
failure will be of great help....
Cheers,
Binod
Abhi poddar (Abhipoddar@.discussions.microsoft.com) writes:
> When I am trying to open Access 2003 report after SQL server is
> stopped I am getting following error:
> Microsoft SQL Server Login
> Connection failed:
> SQL Server Error: 53
> SQL Server does not exist or access denied.
> Our requirement is to supress this error dialog and instead show
> customized msg.
> Any pointer how to supress error dialog in SQL msde because of connection
> failure will be of great help....
You would have to trap it with an ON ERROR and the look at the .Errors
collection. Presuming, that is, that you are using ADO. If you use DAO,
I don't have a clue.
In any case, this does not have much to do with SQL Server, but is something
you need to address in Access, so I would recommend asking in an Access
newsgroup.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp

Connection Timeout - Need Help

Hello,

My app uses sql express on the client work station and has been installed by our application installer as a part of the prerequisites. The sql express install in standard and we've not changed any settings or brought in any tweaks.

All is well in our dev center. However, some of our clients are experiencing a problem when the app starts up. After the PC has been restarted, running the application causes it to crash with a connection time out. However, running it a second time will work with absolutely no issues.

Overall - after a restart, the first sql express connection will time out. I had a post on this earlier here -> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=93279&SiteID=1

MS Lee had suggested -- > "As for the first connection failing and subsequent connections succeeding, one potential cause is the cached last connect information. If you're connecting to a named instance and not specifying a port, then the client will determine the port by querying SQL Browser on the server"

I'm not using a remote sql express. It is running on the local machine. My connection string looks like -->

"Integrated Security=True;User Instance=True;Data Source=.\SQLExpress;AttachDBFilename=<%USERS_LOCAL_FOLDER%>;"

What may be the problem ? Any help/advise will be great. I'll need to sort this out ASAP.

Thanks,

Avinash

System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)

at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32 bytesExpected)

at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()

at System.Data.SqlClient.TdsParserStateObject.ReadByte()

at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)

at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, 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.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)

at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

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 ***.**.Base.DataServices.DataFactory.SQLProvider.GetConnection(String connectionString) in c:\DevNet\SCAH\***.**.Base.DataServices\DataFactory\SQLProvider.cs:line 30

at ***.**.Base.DataServices.DalContext.OpenConnection() in c:\DevNet\SCAH\***.**.Base.DataServices\DALContext.cs:line 166

at ***.**.Base.DataServices.DataManager.GetTable(String sql, String tableName, DataSet dataSet) in c:\DevNet\SCAH\***.**.Base.DataServices\DataManager.cs:line 93

Hi Avinash,

I'd recommend setting the Connect Timeout or Connection Timeout values in the connection string to a higher value. I believe the default is 60 seconds.

The most likely cause of the problem you area seeing is a result of how User Instances work. User Instances launch a new process of SQL Server that runs in the context of the application user. In order to do this, we need to setup some directories in the user's profile and copy some files into that directory. This takes some time to do, and it can cause a timeout to occur the first time the User Instance is created.

That work only needs to be done once, so subsequent connection succed as you've found.

Regards,

Mike Wachal
SQL Express team

Mark the best posts as Answers!

|||

Hello Mike W,

Many thanks for your response. I'll go ahead and try that out.

Question - will the folders/files need to be set up each time the sql process is started ? Won't it use ones created from a previous run ?

Also - some of the clients experiencing this problem are running very modern laptops with generous amounts of RAM and Hard Disk space being available. They were found to be rather light and no heavy apps/processes were running when this occurred. In that light - I suppose 60 Seconds is reasonable time to get started. Thoughts ?

But, I'll go ahead and try it - we'll see how it goes with our next build.

Thanks again.

Regards,

Avinash

|||

Hi Avinash,

The files and folders only need to be created once per user. The second time you try to connect, the folders and files are there and those are used. This is why you're seeing the behavior of a timeout the first time, but success the second (and subsequent) times.

It doesn't really have much to do with how modern your computer is, it has to do with HD access time and how long it takes to copy a file. Simply put, the default timeout is too short to accomplish both the file copy and the connection. I believe the default timeout is 60 seconds, so I'd go with something longer. A little trial and error should get you the right time.

Regards,

Mike

Mark the best posts as Answers!

|||

One other possibility I can think of is: You have some network issue with slow DNS.

Every time you make a connection, we need to do a couple of DNS resolve (in some cases both directions, IP <--> DNS). The connection may timeout if you DNS is slow. The second, windows will pick up the DNS caches and you can get connected much faster. If you know a machine that can expecience this first-time-timeout issue for sure, you can try to ping the name of the server machine before you connect the server. If the issue is gone in this case, you know the reason is slow DNS.

Another way to verify, run "ipconfig /flushdns" from command window and try connect to the server afterwards. See whether you see the timeout issue this time.

|||

This may be a dumb question. But I'll go ahead and ask anyway.

Is this valid in the case of SQL Express and particularly when both the client application(C# Smart Client) accessing the express database and SQL Express itself are running on the same machine ? Cause this is the mode in which we are seeing this issue.

Will a DNS resolve be needed when we use ".\SQLExpress" in the connect string ?

Thanks,

Avinash

|||

I would guess that DNS has nothing to do with accessing a local instance of SQL Express. As I said in an earlier post, the most likely issue here is the delay caused by the file copy that is required the first time (and only the first time) you create a User Instance for a given user.

Has adjusting the timeout eliminated the problem?

Regards,

Mike

|||

Hello Mike,

The last build has just been shipped out. I've set the time out to 120 seconds. Should hear from our clients in a few days.

Will let you know how it goes.

Thanks for all the help,

Regards,

Avinash

|||

Hello Mike,

Just to let you know that increasing the connection time out has indeed solved the problem.

Thanks,

Avinash

Connection Timeout - Need Help

Hello,

My app uses sql express on the client work station and has been installed by our application installer as a part of the prerequisites. The sql express install in standard and we've not changed any settings or brought in any tweaks.

All is well in our dev center. However, some of our clients are experiencing a problem when the app starts up. After the PC has been restarted, running the application causes it to crash with a connection time out. However, running it a second time will work with absolutely no issues.

Overall - after a restart, the first sql express connection will time out. I had a post on this earlier here -> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=93279&SiteID=1

MS Lee had suggested -- > "As for the first connection failing and subsequent connections succeeding, one potential cause is the cached last connect information. If you're connecting to a named instance and not specifying a port, then the client will determine the port by querying SQL Browser on the server"

I'm not using a remote sql express. It is running on the local machine. My connection string looks like -->

"Integrated Security=True;User Instance=True;Data Source=.\SQLExpress;AttachDBFilename=<%USERS_LOCAL_FOLDER%>;"

What may be the problem ? Any help/advise will be great. I'll need to sort this out ASAP.

Thanks,

Avinash

System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)

at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32 bytesExpected)

at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()

at System.Data.SqlClient.TdsParserStateObject.ReadByte()

at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)

at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, 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.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)

at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

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 ***.**.Base.DataServices.DataFactory.SQLProvider.GetConnection(String connectionString) in c:\DevNet\SCAH\***.**.Base.DataServices\DataFactory\SQLProvider.cs:line 30

at ***.**.Base.DataServices.DalContext.OpenConnection() in c:\DevNet\SCAH\***.**.Base.DataServices\DALContext.cs:line 166

at ***.**.Base.DataServices.DataManager.GetTable(String sql, String tableName, DataSet dataSet) in c:\DevNet\SCAH\***.**.Base.DataServices\DataManager.cs:line 93

Hi Avinash,

I'd recommend setting the Connect Timeout or Connection Timeout values in the connection string to a higher value. I believe the default is 60 seconds.

The most likely cause of the problem you area seeing is a result of how User Instances work. User Instances launch a new process of SQL Server that runs in the context of the application user. In order to do this, we need to setup some directories in the user's profile and copy some files into that directory. This takes some time to do, and it can cause a timeout to occur the first time the User Instance is created.

That work only needs to be done once, so subsequent connection succed as you've found.

Regards,

Mike Wachal
SQL Express team

Mark the best posts as Answers!

|||

Hello Mike W,

Many thanks for your response. I'll go ahead and try that out.

Question - will the folders/files need to be set up each time the sql process is started ? Won't it use ones created from a previous run ?

Also - some of the clients experiencing this problem are running very modern laptops with generous amounts of RAM and Hard Disk space being available. They were found to be rather light and no heavy apps/processes were running when this occurred. In that light - I suppose 60 Seconds is reasonable time to get started. Thoughts ?

But, I'll go ahead and try it - we'll see how it goes with our next build.

Thanks again.

Regards,

Avinash

|||

Hi Avinash,

The files and folders only need to be created once per user. The second time you try to connect, the folders and files are there and those are used. This is why you're seeing the behavior of a timeout the first time, but success the second (and subsequent) times.

It doesn't really have much to do with how modern your computer is, it has to do with HD access time and how long it takes to copy a file. Simply put, the default timeout is too short to accomplish both the file copy and the connection. I believe the default timeout is 60 seconds, so I'd go with something longer. A little trial and error should get you the right time.

Regards,

Mike

Mark the best posts as Answers!

|||

One other possibility I can think of is: You have some network issue with slow DNS.

Every time you make a connection, we need to do a couple of DNS resolve (in some cases both directions, IP <--> DNS). The connection may timeout if you DNS is slow. The second, windows will pick up the DNS caches and you can get connected much faster. If you know a machine that can expecience this first-time-timeout issue for sure, you can try to ping the name of the server machine before you connect the server. If the issue is gone in this case, you know the reason is slow DNS.

Another way to verify, run "ipconfig /flushdns" from command window and try connect to the server afterwards. See whether you see the timeout issue this time.

|||

This may be a dumb question. But I'll go ahead and ask anyway.

Is this valid in the case of SQL Express and particularly when both the client application(C# Smart Client) accessing the express database and SQL Express itself are running on the same machine ? Cause this is the mode in which we are seeing this issue.

Will a DNS resolve be needed when we use ".\SQLExpress" in the connect string ?

Thanks,

Avinash

|||

I would guess that DNS has nothing to do with accessing a local instance of SQL Express. As I said in an earlier post, the most likely issue here is the delay caused by the file copy that is required the first time (and only the first time) you create a User Instance for a given user.

Has adjusting the timeout eliminated the problem?

Regards,

Mike

|||

Hello Mike,

The last build has just been shipped out. I've set the time out to 120 seconds. Should hear from our clients in a few days.

Will let you know how it goes.

Thanks for all the help,

Regards,

Avinash

|||

Hello Mike,

Just to let you know that increasing the connection time out has indeed solved the problem.

Thanks,

Avinash

Connection Timeout

Hi, I have a client application that submits heavy processing query to an instance of Sql Server 2005 (Enteriprise Edition). After a few seconds the following exception is raised: "The time available has expired before the completion of the operation or the server is not responding". If I submit to the same application light processing queries the exception is not raised.
The client application is written in VB.net and uses ADO.net. (SqlConnection, SqlCommand,.. classes). The "Timeout connection" property is set to 1000.
Any suggestion?
Thank you.

Hi Ivan,

The ConnectionTimeout property of SqlConnection defines the time boundaries to open a physical connection to the SQL Server. In your case, the physical connection seems to be established within a reasonable frame. However, after the connection is up, the client and the server begin exchanging security information as part of the login process. This is related to a different "login timeout", which unfortunately you don't seem to be able to control from SqlClient.

What is happening on the server during the login process is related to the SOS scheduler operations - I won't go into deep detail, but in a nutshell all the tasks (including processing of login information) are queued. If the queue length is very long, the login information processing may be delayed beyond the login timeout and you will experience your symptoms above. There could also be other factors - the login processing makes calls to the security subsystem, if the entire SQL machine is under heavy stress, those may take longer time, too. You should approach this as a perf problem and use appropriate tools like perfmon, the SOS DMVs, etc.

HTH,
Jivko Dobrev - MSFT
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||Connection Timeout is the timeout for connecting to SQL Server. What you need is COMMAND timeout. Set COMMAND timeout=0 for indefinite period.

Command timeout has to be set on the command object - because it is related to a particular SQL processing.

Connection Timeout

I’ve 2 database servers. These servers communicate with the other’s databases
via TCP/IP with SQL authentication using VB, COM+ & ASP applications. Both
servers are running W2k & SQL2k, each with the latest SPs & hot fixes.
Neither server is a domain server. Server A also supports a VB application
the users access through Terminal Services sessions.
Recently we began experiencing a problem on server A. When logged on to the
server with an administrator account the user can connect to the other
server’s database through the VB applications & through SQL Query Analyzer.
However, when logged on as a user that isn’t an administrator, they cannot
connect to the other server; they get a Timeout Expired error message. This
occurs every time.
From server A when logged on as a standard user we can telnet to server B on
port 1433. We cannot odbcping nor use SQL Query Analyzer to connect to server
B. The IP address & the SQL user /password is included in all connections.
I ran Netmon on server B to see what was coming from server A. I only saw
ack messages. I’m not a Netmon expert, so interpreting these messages is a
little beyond me.
I also suspect the problem is on server A. Why else would one user be able
to connect & another not. Beyond that I’m lost.
The only error I see in any of the Event logs from server A is an error
described by KB 326912.
Thanks in advance for any ideas.
You need to make the connections from the client side and review them. See
if the tcp 3 way handshake is completing.
Q169292 The Basics of Reading TCP/IP Traces
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||I'm able to see a 3 Way Hand Shake & Graceful Close. There is also some Push
activity in the trace.
Examining this activity is iffy at best, because these are production
servers. My problem only occurs when the user on Server A is not an
administrator. Some of the activity in the capture could be the result of
other user activity. I think the trace I captured was during an isolated
period, but I cannot be assured of this. The Hand Shake & Grageful Close were
the 1st & last events in the capture.
"Kevin McDonnell [MSFT]" wrote:

> You need to make the connections from the client side and review them. See
> if the tcp 3 way handshake is completing.
> Q169292 The Basics of Reading TCP/IP Traces
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>
|||Is there a policy defined on the system that might explain why there is a
permission problem?
gpresult.exe will show you if any policies are in place.
Are there any security templates in use?
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||I'm not aware of a policy that is set to do that.
I ran gpresult without learning much, which didn't surprise me since this is
a stand-alone server.
There are Local Policies, most are default values. I did read through all of
these & nothing stuck out as a possible culprit. Do you have any policies in
mind that may need further scrutiny?
Sam
"Kevin McDonnell [MSFT]" wrote:

> Is there a policy defined on the system that might explain why there is a
> permission problem?
> gpresult.exe will show you if any policies are in place.
> Are there any security templates in use?
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>
|||Clients need "access this computer from the network" permission in order to
establish a connection.
Can the same client map a drive to the server?
Does the problem happen with Named Pipes as well as TCP/IP?
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||I checked the 'Access this computer from the Network' local policy. It
includes Users.
The user connects to Server A through a Terminal Services Connection.
Mapping a drive isn't an option I've pursued.
Since these are standalone servers I don't know how to connect from one to
the other using named pipes. (One is in Atlanta & the other in Washington DC.
They communicate via Internet. Force Encryption is on.) If I enter the
www.servername.com of Server B, I think that uses TCP/IP. I tried it in Query
Analyzer & got the Timeout message.
I installed FileMon from www.SysInternal.com on Server A. I saw some files
that were not found, but the system reverted to Winnt\system32 for the same
files & was succesful. I didn't see any unsuccessful attempts logged for the
User. This leads me to suppose it isn't a file permission problem.
I restarted Server A last night, but this didn't accompolish anything either.
Sam
"Kevin McDonnell [MSFT]" wrote:

> Clients need "access this computer from the network" permission in order to
> establish a connection.
> Can the same client map a drive to the server?
> Does the problem happen with Named Pipes as well as TCP/IP?
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>
|||I would run Microsoft Network Monitor from the Terminal Server machine to
trace the traffic to SQL.
Compare the admin trace to the user trace.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||I have the traces. I was able to run them when there wasn't any other
activity between the systems.
Both traces are escentially the the same except in the admin trace I see
more TDS protocol packets. Both start with the 3 Way Hand Shake & end with
the Graceful Close. The 1st 12 packets of each trace are the same. Then the
admin trace has 12 TDS protocol packets with a description beginning with
'UNKNOWN EPM ACK Len ='. The trace that fails does not have any of these
packets.
The user trace does have some TDS protocol packets, but for some reason that
the trace doesn't show, it doesn't continue with the TDS packets the admin
trace has.
Sam
"Kevin McDonnell [MSFT]" wrote:

> I would run Microsoft Network Monitor from the Terminal Server machine to
> trace the traffic to SQL.
> Compare the admin trace to the user trace.
> Thanks,
> Kevin McDonnell
> Microsoft Corporation
> This posting is provided AS IS with no warranties, and confers no rights.
>
>
|||Hi Sam,
Sounds like you made a good capture. Unfortunately, the best way to
resolve this would be to open a case and have a SQL Engineer review the
traces. It would be too difficult to diagnose the traces in this forum.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Connection Timeout

I am trying to upload data to my sql database via a web service installed on
the same machine as sql server. When my upload takes more than about 2
minutes I get a timeout error message from my web service and the data
tranfer was not completed. Transfers taking less time complete
satisfactorily. My web.config file for the web service has httpRuntime
executionTimeout set to 360 and maxRequestLength set to 30720. I continue to
get timeout error messages from my web service. I need my connection to stay
open for upto 5 minutes for those situations when I have large files to move
or my client computer has a slow internet upload capability. Am I forgetting
some setting that still needs to be made?
Thanks,
Fred Herring
there is a proxytimeout setting somewhere increase it like this
proxy.Timeout=2000;
see here
http://www.dotnetbips.com/displayarticle.aspx?id=112
we had the same problem and this fixed it
"Fred Herring" <FredHerring@.discussions.microsoft.com> wrote in message
news:B5CBD211-81B5-4693-A2A3-32FBA66780AF@.microsoft.com...
>I am trying to upload data to my sql database via a web service installed
>on
> the same machine as sql server. When my upload takes more than about 2
> minutes I get a timeout error message from my web service and the data
> tranfer was not completed. Transfers taking less time complete
> satisfactorily. My web.config file for the web service has httpRuntime
> executionTimeout set to 360 and maxRequestLength set to 30720. I continue
> to
> get timeout error messages from my web service. I need my connection to
> stay
> open for upto 5 minutes for those situations when I have large files to
> move
> or my client computer has a slow internet upload capability. Am I
> forgetting
> some setting that still needs to be made?
> Thanks,
> Fred Herring
>
>

connection timeout

Hi there
I'm using SQL Server 2000. I often use the UPDATE ... SET ... statements to
change data in my database, affecting up to 3 million rows of data. If I
issue the statements from Enterprise Manager I get a "timeout expired" error
on large queries, whereas if I execute the queries from Query Analyser, they
perform fine if very slowly. Mostly at the moment I'm happy that they
execute.
Now, if I issue the statements over an ADO connection from Microsoft Excel
(using a VBA procedure, with the statements issued either on-the-fly or via
a stored query), I get the same "timeout expired" error.
Any ideas?
Best regards
Loane
Hi
Make sure that your database and log file have been grown big enough before
you run the update.
Make sure that the Where clause column is indexed.
If possible, break up your update into smaller pieces.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Loane Sharp" <look_sharp_not@.hotmail.com> wrote in message
news:u$mMC4GZFHA.228@.TK2MSFTNGP12.phx.gbl...
> Hi there
> I'm using SQL Server 2000. I often use the UPDATE ... SET ... statements
> to change data in my database, affecting up to 3 million rows of data. If
> I issue the statements from Enterprise Manager I get a "timeout expired"
> error on large queries, whereas if I execute the queries from Query
> Analyser, they perform fine if very slowly. Mostly at the moment I'm happy
> that they execute.
> Now, if I issue the statements over an ADO connection from Microsoft Excel
> (using a VBA procedure, with the statements issued either on-the-fly or
> via a stored query), I get the same "timeout expired" error.
> Any ideas?
> Best regards
> Loane
>
|||That is because EM has a default timeout for connections at 30 seconds as do
most drivers. QA on the other hand defaults to 0 which means it never times
out. When ever possible try to avoid doing operations on so many rows all
in one transaction. Most operations such as that can sit in a loop and do
the updates in smaller batches of say 10 or 20 thousand rows at a time.
That way you should never timeout and won't block other users as much or for
as long a period of time. There are plenty of ways to approach a situation
such as that. If you need help then post the DDL for the table and the
update statement you normally would use.
Andrew J. Kelly SQL MVP
"Loane Sharp" <look_sharp_not@.hotmail.com> wrote in message
news:u$mMC4GZFHA.228@.TK2MSFTNGP12.phx.gbl...
> Hi there
> I'm using SQL Server 2000. I often use the UPDATE ... SET ... statements
> to change data in my database, affecting up to 3 million rows of data. If
> I issue the statements from Enterprise Manager I get a "timeout expired"
> error on large queries, whereas if I execute the queries from Query
> Analyser, they perform fine if very slowly. Mostly at the moment I'm happy
> that they execute.
> Now, if I issue the statements over an ADO connection from Microsoft Excel
> (using a VBA procedure, with the statements issued either on-the-fly or
> via a stored query), I get the same "timeout expired" error.
> Any ideas?
> Best regards
> Loane
>

Connection Timeout

Hello,
We have a sitaution at a client site where the connection string in the our
application times-out on 2 of the PC's yet 2 other PC's work fine and the
server works fine. I tried altering the Remote Connection Timeout in the SQL
Express properties from the default of 20 seconds to 60 seconds and
restarting the SQL Server but it doesn't appear to have made a difference.
They are not stopped from working, after the connection timeout box appears
the user can click Okay and bingo they are connected.
Where else should we be looking?
Thank you!
ChrisAs far as I recall, remote connection timeout was an option removed in
SQL2000. You may want to look into the connection string used by the app to
connect to the SQL instance. For instance, if it is using the .NET provider
for SQL Server, the connection timeout is set in the
System.Data.SqlClient.Connection.Timeout property.
Linchi
"Chris Marsh" wrote:
> Hello,
> We have a sitaution at a client site where the connection string in the our
> application times-out on 2 of the PC's yet 2 other PC's work fine and the
> server works fine. I tried altering the Remote Connection Timeout in the SQL
> Express properties from the default of 20 seconds to 60 seconds and
> restarting the SQL Server but it doesn't appear to have made a difference.
> They are not stopped from working, after the connection timeout box appears
> the user can click Okay and bingo they are connected.
> Where else should we be looking?
> Thank you!
> Chris
>
>|||Chris,
you could change the timeout property of the connection string / command
object to overcome the issue. However I'd start by looking at network
connectivity between the 2 PCs and the main box. You could start with
ping -t but your network admin guys might have some better tools for this.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .