Java / JDBC
Explain JDBC PreparedStatement.
JDBC PreparedStatement object stores the precompiled SQL statement that can be used efficiently to execute the query multiple times.
The Prepared Statement may be parametrized. It also provides a bunch of setter methods (setInt, setString and so on) to set the IN parameters for the query and it is compatible with specified sql types as input parameter. As an example, for INTEGER sql datatype use setInt method.
PreparedStatement pstmt = con.prepareStatement("UPDATE DEPARTMENT SET EMP_COUNT = ? WHERE ID = ?"); pstmt.setBigDecimal(1, 1500); pstmt.setInt(2, 100);
More Related questions...