views:

124

answers:

2

How can I automatically kill a query that runs for more than 60 seconds?

The queries are called from a VB ASPX page to an Oracle database.

I don't mind putting the limit in the database itself or in the calling aspx code.

FYI: I use a asp:GridView bound to a 'asp:SqlDataSource` for querying the database.

FYI: A connectionString for System.Data.OracleClient does not have a Connection Timeout property (link)

A: 

Set the CommandTimeout property on the command object in your vb.net code.

Joel Coehoorn
In that case, you can set a timeout for the connection in the connection string.
Joel Coehoorn
+2  A: 

In the database, you can create a PROFILE for a user which will terminate a statement (or session) if it exceeds certain limits. However these are measured in LOGICAL_READS_PER_CALL or CPU_PER_CALL rather than time. Also, bear in mind that for INSERT/UPDATE/DELETE/MERGE, the termination will require any changes done to be rolled back, which can take additional time.

Gary
Just to clarify, CPU_PER_CALL is time, but purely CPU time not end-user time.
Gary