Link to home
Start Free TrialLog in
Avatar of Jeanne_Kornkven
Jeanne_Kornkven

asked on

OleDb Command Timeout setting is ignored when calling DB2 stored procedure

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
Avatar of Member_2_276102
Member_2_276102

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
Avatar of Jeanne_Kornkven

ASKER

Tom, I also set the Command Timeout to 1 second, and that is what I am trying to test.
Avatar of Vitor Montalvão
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.
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.
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.
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.
ASKER CERTIFIED SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial