File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes How can I know when a stored procedure finishes execution? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How can I know when a stored procedure finishes execution?" Watch "How can I know when a stored procedure finishes execution?" New topic
Author

How can I know when a stored procedure finishes execution?

Beth Lampard
Greenhorn

Joined: Feb 25, 2010
Posts: 2
Hello everyone!

I've got an Oracle stored procedure which I am calling from a Java applet. This procedure takes more than 20 mins to finish and returns no results.
Is there any way to know when the procedure ends? (Prefferably without having to alter the procedure's code).

The procedure does a lot of delete/update/insert queries to several tables.
Up until now I have tried this:



but with no effect.

Please share any ideas if any...!
Kai Witte
Ranch Hand

Joined: Jul 17, 2004
Posts: 356
Hello,

I believe that execute blocks. More logging statements would certainly help you.

Kai


Kai Witte's business website Kai Witte's private homepage
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10

Correct me if I'm wrong, but
I believe thatwaits until the statement is executed.

If your procedure takes 20 minutes, your code would stop at this line 4 for 20minutes.
If your execute() would have returned a rs, you would now immediately after executing line 4.
If execute() returned null, rs will stay null.
No piece of code you have put below line 4 will change rs.

Regards, Jan



OCUP UML fundamental and ITIL foundation
youtube channel
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2516
    
  10

and welcome to JavaRanch!
Beth Lampard
Greenhorn

Joined: Feb 25, 2010
Posts: 2
Thank you everyone for your replies and welcomes


Correct me if I'm wrong, but I believe that

waits until the statement is executed.


It does, that's the main reason the statement execution is in a thread.
I was under the impression that rs becomes true when the stored procedure ends execution.
It doesn't though. In my case it returns false but it will do!

I believe that execute blocks. More logging statements would certainly help you.


True! I could use logging statements and check these to see when the stored procedure ends but it costs a lot!
If we assume that the logs are a table I would have to every so often run a query there to check if the procedure ended.
Doesn't sound like the best solution to me.


Thank you for your help both!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I know when a stored procedure finishes execution?