June 2004
Intermediate to advanced
848 pages
21h 28m
English
Another way to boost performance is to precompile the SQL statement using what is termed a “Prepared statement.” That technique and the related one of “Stored procedures” are described in this section.
A SQL statement is precompiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement repeatedly, often changing some of the argument values at run-time. You get a PreparedStatement using a method of your Connection object. It's easiest to see with a code example:
PreparedStatement pstmt = conn.prepareStatement( "UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?");pstmt.setBigDecimal(1, 150000.00);pstmt.setInt(2, linden4303); ...
Read now
Unlock full access