[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SQL Server 7 stored procedure won't time out using command object

Posted on 2002-05-29
7
Medium Priority
?
174 Views
Last Modified: 2010-05-02
I am baffled on this one...

We have a VB 6 component running in MTS.  I have set the commandtimeout on the command to be 90 seconds.  Occasionally on one stored procedure call, we get a timeout error, which is fine (this stored procedure can take awhile to run).  

However, sometimes the stored procedure NEVER times out.  Our custom logging shows it will hang inside the stored procedure call indefinitely.  It will NOT stop by itself, I have to kill the process and shut down the package in MTS.

When this happens, the CPU percentage on the application server running the component (not the database server) goes up to 100% until I kill the task/shut down the package.

I don't think this is a data or stored proc problem.  The error that gets logged in the event viewer of Windows NT is "One or more errors occurred during processing of command."  The source on the error is not SQL Server, it is the component.  Also, this stored procedure gets called 2000+ times per day without incident.

Any ideas?
0
Comment
Question by:bfassler
7 Comments
 
LVL 1

Expert Comment

by:crw030
ID: 7043136
Do you log the stored procedure parameters that are being passed each time?  If so can you verify via a manual sp call they parameters supplied are not the problem?

One thing I have seen with SQL stored procedure calls from VB is that sometimes VB perceives there to be multiple recordsets being returned by the procedure (which is frustrating because you don't see them in Query Analyzer).  

Maybe it's just something I'm doing, but I have resorted to checking my resultant recordset to see if it contains multiple recordsets (using Set rs2=rs1.NextRecordset)
(Probably a better way available from one of the VB gurus)
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 7043141
You might ask a 0 point question in the MS-SQL Experts area under Databases and include a link to this question.

mlmcc
0
 

Author Comment

by:bfassler
ID: 7043147
I do log the parameters.  It is not the parameters.  As soon as I start the program back up, the stored procedure runs fine (for the same parameters that were a problem before).  Also, a manual call works as well.

There is no recordset returned by the stored procedure.  Basically we just run the execute method on the command object.  Pretty simple.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Expert Comment

by:crw030
ID: 7043164
Can you post a code snippet of the Execute call and the code following it until the component would normally exit?

Could you write an event indicating the Execute call finsihed?
0
 

Author Comment

by:bfassler
ID: 7044415
BEGIN CODE

On Error Resume Next
cmd.Execute
   
' If we error out of Stored Procedure due to a timeout, then make sure to rollback any transaction that was started.

    If Err.Number <> 0 Then
        sOrigError = Err.Description
        sOrigErrSource = Err.Source
        If InStr(1, UCase(Err.Description), "TIMEOUT") > 0 Then
            Set cmd1 = New ADODB.Command
            Set cmd1.ActiveConnection = cmd.ActiveConnection
            cmd1.CommandType = adCmdStoredProc
            cmd1.CommandText = "AE_End_Transaction"
            cmd1.Execute
            Set cmd1 = Nothing
        End If
        On Error GoTo errhandler
        Err.Raise vbObjectError + 2000, sOrigErrSource, sOrigError
    End If
   
    On Error GoTo errhandler
         
    Set cmd.ActiveConnection = Nothing
   
    Set cmd = Nothing
 
    If bLog Then Call log(spName, "  end", False, param())

END CODE

We never log the last line of code, where the stored procedure ends.  This large stored procedure is a vendor stored procedure -- it is very long and contains many nested transactions.  We WERE having a problem where we were timing out within a transaction and later, when the connection was shut down, it would roll back MANY transactions.  That's what the middle code does.  Maybe I need to put some logging in there and see if we're getting stuck in there.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7851276
Hi bfassler,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

bfassler, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7912867
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question