Asked by:
Timeout for OracleCommand object

Question
-
User-1644808427 posted
Hi,
I am executing a ORACLE Stored procedure using System.OracleClient.OracleCommand and DataAdaptor using the fill method.
But I want to set a timeout such that if the command object execution takes more than say 3 min it should get aborted so that I can show an error message to the user.
Let me know how can this be done,
Regards
Sachi
Friday, January 2, 2009 9:29 PM
All replies
-
User-563238995 posted
Give the following a look: http://msdn.microsoft.com/en-us/library/tyy0sz6b.aspx. You should be able to set CommandTimeout property on the command object being demonstrated.
Example: command.CommandTimeout = 3
Saturday, January 3, 2009 6:47 PM -
User-1644808427 posted
No,CommandTimeout is not supported for OracleCommand Object.
Can this be achieved using multithreading.In one thread execute the stored procedure and in another thread, wait for say 3 min,if the first thread doesnt complete then abort it and throw error message.
Have anyone tried this? If so pl. provide sample code.
Monday, January 5, 2009 8:26 AM -
User-563238995 posted
What framework are you using?
According to http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oraclecommand.commandtimeout(VS.80).aspx it states:
.NET Framework Class Library<!---->OracleCommand.CommandTimeout Property<!----><!--Content type: DocStudio. Transform: devdiv2mtps.xslt.-->Note: This property is new in the .NET Framework version 2.0.
Gets or sets the wait time before terminating the attempt to execute a command and generating an error.
Friday, January 9, 2009 11:13 PM -
User-1039022135 posted
The documentation lies... .CommandTimeout does not exist for OracleCommand.
Wednesday, February 18, 2009 2:59 PM -
User753410315 posted
The documentation lies... .CommandTimeout does not exist for OracleCommand.
No it doesn't lie, it's just hidden from IntelliSense. Also remember that the connection time is in seconds not minutes. So for 3 minutes, just set cmd.CommandTimeout=180;
Monday, January 17, 2011 10:01 AM -
User851146378 posted
Why wouldn't IntelliSense show ConnectionTimeout? How would I get it to show that?
Friday, September 9, 2011 7:47 AM