O'Reilly logo

Java™ Phrasebook by Timothy Fisher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a Stored Procedure

CallableStatment cs =
											conn.prepareCall("{ call ListAllUsers }");
											ResultSet rs = cs.executeQuery( );

Stored procedures are database programs that are stored and maintained within the database itself. You can call one of these stored procedures from within Java using the CallableStatement interface and the prepareCall() method of the Connection object. A CallableStatement returns a ResultSet object just as a Statement or PreparedStatement does. In this phrase, we call the stored procedure ListAllUsers with no parameters.

A CallableStatement object can take input parameters also. Input parameters are handled exactly as they are when using a Prepared Statement. For example, here we show how you might call a stored procedure ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required