Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How cancel query through JDBC?

Re: How cancel query through JDBC?

From: Brian Peasland <dba_at_remove_spam.peasland.com>
Date: Thu, 31 Jul 2003 17:04:18 GMT
Message-ID: <3F294C12.E154EDE6@remove_spam.peasland.com>


An easy way in Oracle 9i is to use the new FOR UPDATE WAIT clause. You can specify the timeout isnstead of waiting forever. JDBC probably won't handle this feature for you, but you can place the update logic in a stored proc and have your Java program call the stored proc.

HTH,
Brian

Don Seiler wrote:
>
> I have pretty much the exact same question. Although the problem is that
> I have update queries that are waiting indefinitely on tables or rows that are locked by
> another application. I tried java.sql.Statement.setQueryTimeout(x) but it
> didn't timeout. I've now read that setQueryTimeout won't detect a problem
> in my instance.
>
> I need a way to automatically have my update query be automatically timed
> out instead of waiting forever.
>
> Are you sure this isn't possible?
>
> Don.
>
> On Wed, 30 Jul 2003 20:23:45 +0200, Sybrand Bakker wrote:
>
> > On Wed, 30 Jul 2003 18:08:41 GMT, "Randy Nichols"
> > <randynichols_at_yahoo.com> wrote:
> >
> >>Pardon if this is a repeat. I never saw answer to previous post.
> >>
> >>Is there a way to abort an Oracle 8i, 9 query that has been initiated via
> >>JDBC (for instance, if it is running too long)?
> >>
> >>-Randy Nichols
> >>
> >
> > No, there isn't directly.
> > You can kill your query from a different session by issuing
> > alter system kill session '<sid>,<serial#>', which you'll need to
> > determine first of course from v$session.
> > You can configure *profiles* to make sure your session is killed
> > automatically when you reach a certain limit,
> > and you can use resource manager to limit the resources your process
> > is using.
> > But above all you would be recommended to write efficient queries.
> >
> >
> > Sybrand Bakker, Senior Oracle DBA
> >
> > To reply remove -verwijderdit from my e-mail address

-- 
===================================================================

Brian Peasland
dba_at_remove_spam.peasland.com

Remove the "remove_spam." from the email address to email me.


"I can give it to you cheap, quick, and good. Now pick two out of
 the three"
Received on Thu Jul 31 2003 - 12:04:18 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US