Re: ADO Connection Timeout



Robert McCarter wrote:
When I am running my program, and I unplug the
cable it still takes 30 seconds to get an error. I have tried
ConnectionTimeout on the connection and CommandTimeout on the Command
and had no luck.

This is strange. When I use the following vbscript code to try to open a
connection to a nonexistent database file I get an error back almost
instantaneously, although I am presuming some sort of caching is going
on, because my initial attempts took about a second.

dim cn, t
t=now
set cn=createobject("adodb.connection")
cn.commandtimeout=2
on error resume next
cn.open "provider=microsoft.jet.oledb.4.0;" & _
"data source=\\nonexistentserver\someshare\nonexistent.mdb"
if err<> 0 then
msgbox err.description,,(now-t)
else
msgbox "success",(now-t)
end if
cn.close

I was testing the relevance of the connectiontimeout setting, which I
believe only applies to the time period following the location of the
database file/server. Once the file/server is found, that is when the
actual connection attempt is made. The actual connection attempt is
limited by the connectiontimeout property. The timeout for locating a
network resource is controlled by either the network software or the
OS - I'm not sure which.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


.



Relevant Pages

  • Re: Timeout expired - solve via ConnectionString?
    ... timeout from the connection string, ... >> ConnectionTimeOut!= CommandTimeout. ... you cannot modify commandtimeout using connection string. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: command time out error
    ... I've never tried to set the commandTimeout in the connection string. ... vs. a script timeout? ... This email account is my spam trap so I ...
    (microsoft.public.inetserver.asp.general)
  • Re: ADO Connection Timeout
    ... I realize that express is NOT sql server, ... ConnectionTimeout on the connection and CommandTimeout on the Command ... network resource is controlled by either the network software or the ... Please reply to the newsgroup. ...
    (microsoft.public.data.ado)
  • RE: How to provide a CommandTimeout at the Connection level.
    ... flexability of specifying different timeout values for different SQL ... How to provide a CommandTimeout at the Connection level. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Using this ADO structure is there a way to access the "CommandTimeout" property?
    ... the Open method of ADO recordset But in your case you are using connection ... Another way is to use Execute method of ADO Command to open recordset. ... this case you would need to set CommandTimeout property of the Command ...
    (microsoft.public.data.ado)