Re: ODBC timeout when xp_cmdshell execute a 'long' script

From: Narayana Vyas Kondreddi (answer_me_at_hotmail.com)
Date: 05/17/04


Date: Mon, 17 May 2004 10:02:24 +0100

You'd want to change the CommandTimeout property of the object. More
information on timeouts at:
http://vyaskn.tripod.com/watch_your_timeouts.htm
http://vyaskn.tripod.com/sql_odbc_timeout_expired.htm

-- 
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"ECee" <anonymous@discussions.microsoft.com> wrote in message
news:1EAF7064-F2F6-4FB3-BECC-D4D3AADC881F@microsoft.com...
Hi all, I have this problem that seems to be related to ODBC connection
timeout. But after some research online and applying some identified
recommendation, mainly by setting the connection object's timeout value to 0
(infinity), the problem persist.
Here's my setup.
MDAC 2.8
W2K3 Servers
SQL Svr 2000 SP3
I have an ASP page connecting to a SQL server retrieving data via a single
stored procedure call. Here's the snippet of my ASP ...
****************************************************************************
*
Set mobjRS = CreateObject("ADODB.Recordset")
Set mobjAdoConnection = CreateObject("ADODB.Connection")
    With mobjAdoConnection
         .ConnectionString = ConnectionString
         .ConnectionTimeout = 0
         .CursorLocation = 3
         .Properties("Prompt") = 4
         .Open
         If .State = 1 Then
            blnSuccess = True
         End If
    End With
sSQL = "exec usp_storedproc '" & strvar1 & "','" & strvar2 & "','" & strvar3
& "'"
Set mobjRS = mobjAdoConnection.Execute(sSQL) ' this is the line reported by
my error description below
****************************************************************************
*
usp_storedproc is a stored procedure that will call xp_cmdshell to invoke a
vbscript... which looks something like below:
****************************************************************************
*
...
create table #temp1 (gname varchar(255))
select @cmd = 'cscript //NOLOGO C:\script.vbs ' + @vchvar1 + ' ' + @vchcar2
insert into #temp1
...
****************************************************************************
*
script.vbs contain ADSI code to query domain information base on var1 and
var2. For some query, it can be as fast as near instanteneous. However,
there are also some which may take as long as 30-50 seconds, or even more.
I read somewhere that xp_cmdshell is a synchronous call, and hence will be
affected by how fast the query in my vbs finishes... but this shouldn't
affect how my ASP runs. Wrong?
Having said all that, here are some of my findings...
1) if the vbs finished instantaneously, the ASP page display correctly.
2) if the vbs took longer, say 30-50 seconds, the ASP page displays the
following error.
****************************************************************************
*
Microsoft OLE DB Provider for ODBC Drivers error '80040e31'
[Microsoft][ODBC SQL Server Driver] Timeout expired
/script.vbs, line XXX (see the comment tag in above code)
****************************************************************************
*
I have tried running the "cscript..." line found in stored procedure within
a cmd window - it executed fine, just that it takes a while.
I have also tried trapping the stored proc call with profiler and run the
exact same line using exact user context in query analyzer - it executed
fine, just that it takes a while...
Lastly, I have also tried setting the ASP timeout setting from the current
90 seconds to 900 seconds... the problem persists.
CaAny advise on other troubleshooting approaches? Or if at all possible, let
me know what actually went wrong?
Thanks in advance.


Relevant Pages

  • Re: Check Linked Table Connection
    ... That will only test to make sure the connection is available. ... Run the query with a 20 second timeout. ... but I don't have any direct access to their SQL Server nor their ... I am an outside programmer that end-users contract, ...
    (comp.databases.ms-access)
  • Re: Increase Connection Command timeout globally
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... in Stored procs which is causing it to timeout. ... Connection and Command timeout settings are done on the client. ... I expect you'll have to visit each Command object declaration and set the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: First connection from Vista client to SQL Server 2005 times out
    ... I think we have the timeout set to 30 seconds.The same ... I have found that SQL Server Management ... Times out on the first connection attempt, ... manifest, it works fine with no other changes. ...
    (microsoft.public.data.ado)
  • Re: Timeout
    ... timeout for every SqlCommand (I don't know which one the user will use as the ... QUERY timeout problem--not one associated with a connection. ... database increases in size the system takes more time. ... Hitchhiker's Guide to Visual Studio and SQL Server ...
    (microsoft.public.dotnet.framework.adonet)
  • ODBC timeout when xp_cmdshell execute a long script
    ... But after some research online and applying some identified recommendation, mainly by setting the connection object's timeout value to 0, the problem persist. ... I have an ASP page connecting to a SQL server retrieving data via a single stored procedure call. ...
    (microsoft.public.sqlserver.programming)