Saturday 1 September 2012

Define PreparedStatement.


• A Preparedstatement is an SQL statement which is precompiled by the database.

• By precompilation, the prepared statements improve the performance of the SQL commands that are executed multiple times (given that the database supports prepared statements). 

• After compilation, prepared statements may be customized before every execution by the alteration of predefined SQL parameters.

Code:

PreparedStatement pstmt = conn.prepareStatement("UPDATE data= ? WHERE vl = ?");
pstmt.setBigDecimal(1, 1200.00);
pstmt.setInt(2, 192);

No comments:

Post a Comment