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=* ******;Use r ID=*******;Data Source=******;Persist Security Info=True;Connect Timeout=1
Command
<add key="CommandTimeout" value="1"/>
iCommandTimeout = Ctype(ConfigurationManager .AppSettin gs("Comman dTimeout") .ToString, Int32)
Dim command As New OleDbCommand(strTableOwner & "." & sStoredProcToCall, conn)
command.CommandTimeout = iCommandTimeout
command.CommandType = CommandType.StoredProcedur e
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
Command
<add key="CommandTimeout" value="1"/>
iCommandTimeout = Ctype(ConfigurationManager
Dim command As New OleDbCommand(strTableOwner
command.CommandTimeout = iCommandTimeout
command.CommandType = CommandType.StoredProcedur
ASKER
Tom, I also set the Command Timeout to 1 second, and that is what I am trying to test.
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.
ASKER
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.
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.
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Tom