This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes I Need tutorial calling oracle stored procedures Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "I Need tutorial calling oracle stored procedures" Watch "I Need tutorial calling oracle stored procedures" New topic
Author

I Need tutorial calling oracle stored procedures

majid nakit
Ranch Hand

Joined: Jun 26, 2001
Posts: 164
Hi,

can you please point me to a tutorial on how to call Oracle stored procedures from java ?

Thanks.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
There are a couple of ways to do this. Learn the JDBC API. Pay attention to CallableStatement class and executeQuery methods.
majid nakit
Ranch Hand

Joined: Jun 26, 2001
Posts: 164
it will be helpful if you can provide an example of aclling stored procedures that return one object or more (for example a stored pro that returns an employee or a SP that returns employees).

My problem here is what is the OUT TYUPE of eather cases ?

CallableStatement cstmt = conn.prepareCall("{? = CALL geOneEmployee(?)}");
cstmt.registerOutParameter(1, what should I put here?);


And

CallableStatement cstmt = conn.prepareCall("{? = CALL geEmployees()}");
cstmt.registerOutParameter(1, what should I put here?);


Thanks.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Understand that stored procedures from relational database management systems cannot create Java-based objects.

Below is an example of executing a stored procedure named getAccountData using the JDBC API.

 
jQuery in Action, 2nd edition
 
subject: I Need tutorial calling oracle stored procedures