Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I Need tutorial calling oracle stored procedures

 
majid nakit
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic