Solved

OleDb Command Timeout setting is ignored when calling DB2 stored procedure

Posted on 2014-11-03
8
566 Views
Last Modified: 2014-11-18
My .NET application is calling a DB2 stored procedure (z/os).
I set the command timeout to 1 second.  I set up the stored procedure to delay for 10 seconds and then process.
I would expect the .NET application to return an error after 1 second, but it does not.  It continues waiting for the stored procedure to complete.
 
Connection String
 connectionString="Provider=IBMDADB2;Password=*******;User ID=*******;Data Source=******;Persist Security Info=True;Connect Timeout=1

Command
 <add key="CommandTimeout"  value="1"/>
 iCommandTimeout = Ctype(ConfigurationManager.AppSettings("CommandTimeout").ToString, Int32)

Dim command As New OleDbCommand(strTableOwner & "." & sStoredProcToCall, conn)
            command.CommandTimeout = iCommandTimeout
            command.CommandType = CommandType.StoredProcedure
0
Comment
Question by:Jeanne_Kornkven
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 27

Expert Comment

by:tliotta
ID: 40436346
Please explain what you mean by "I set up the stored procedure to delay for 10 seconds and then process." AFAIK, that doesn't seem related to whether or not a Connect Timeout=1 will be signaled. A connection probably happens in less than a second.

Tom
0
 

Author Comment

by:Jeanne_Kornkven
ID: 40436602
Tom, I also set the Command Timeout to 1 second, and that is what I am trying to test.
0
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 40446897
The connection timeout is the time that the application is waiting for a connection to be opened on the server and not the maximum time allowed for a query to run. The server didn't throw an error because it could got connected in less than 1 second.
0
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

 

Author Comment

by:Jeanne_Kornkven
ID: 40447563
Vitor, I also set the Command Timeout to 1 second, and that is what I am trying to test.  Sorry if my example was confusing.
0
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 40447623
Jeanne, hi just realize now. Sorry, my fault.
Command timeout it's the maximum time waiting for a response from the server. Since you have a SP delaying 10 seconds I would say that while there's feedback from the server, won't throw a timeout error. I mean, from the DB side it's waiting for 10 seconds but the server is still communicating with your application.
You would test it better with a long running query than something that only do a pause.
0
 

Author Comment

by:Jeanne_Kornkven
ID: 40448051
Vitor, I am calling  a COBOL stored procedure on the IBM mainframe.  So we are actually inside the COBOL program when the delay is happening.  I did actually try a pause first, which had the same result.
0
 
LVL 50

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40449191
Jeanne, it was what I said. Don't test with delay/pause. You need to test with queries. Try with a query that you know will take long to be executed.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

718 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