Can beans use stored procedures in a database?

Richard Monson-Haefel

Stored procedures can be used by session beans that access the database using JDBC and bean-managed entity beans that use JDBC to manage their own persistence. JDBC provides a call interface for using stored procedures. An example is provided below:

InitialContext cntx = new InitialContext( );
DataSource dataSource = (DataSource) cntx.lookup("java:comp/env/jdbc/mydatabase");
Connection con = dataSource.getConnection( );

CallableStatement storedProcedure = con.prepareCall("{? = call someprocedure [(?,?)]}");

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact