File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Oracle/OAS and the fly likes Returning JDBC resultset from Java stored proc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Returning JDBC resultset from Java stored proc" Watch "Returning JDBC resultset from Java stored proc" New topic

Returning JDBC resultset from Java stored proc

John Sinues
Ranch Hand

Joined: Feb 21, 2000
Posts: 52
In the Oracle example found here, the author describes how one can return a resultset from a Java stored procedure. The example is pretty straightforward and easy to understand. My concern, however, is the Java stored procedure prone to leaks? Since, you are returning a resultset, you cannot explicitly close the database connection, statement, or resultset. However, closing these objects are recomended to prevent things such as cursor leaks. Does anyone know how Oracle 9i handles things such as this?

- John
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

It's important to close the connection/statement/resultset in Java (on an app server) because the JVM is bad at cleaning up resources. If you write a stored proc in PL/SQL, the database server cleans up after itself automatically. So I imagine a Java stored proc would work in a similar way. You could try it to make sure though.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Returning JDBC resultset from Java stored proc
It's not a secret anymore!