Home

 

Developing Java stored procedures

A stored procedure is a block of procedural constructs and embedded SQL statements that are stored in a database and can be called by name. Stored procedures can improve application performance and reduce database access traffic. All database access must go across the network, which, in some cases, can result in poor performance. For each SQL statement, a database manager application must initiate a separate communication with database.

To improve application performance, you can create stored procedures that run on a database server. A client application can then simply call the stored procedures to obtain results of the SQL statements that are contained in the procedure. Because the stored procedure runs the SQL statements on the server for you, database performance is improved.

Stored procedures can be written as SQL procedures, or as C, COBOL, PL/I, or Java programs. In this section, we develop a Java stored procedure against the ITSOBANK Derby database to obtain the account information based on a partial customer last name. While doing so, we will give also give $100 credit to every account retrieved (this would be nice!).

ibm.com/redbooks