Posted in Java EE, JDBC

Statement vs. PreparedStatement in JDBC

Statement

PreparedStatement

for executing static SQL statements execute dynamic queries with parameter inputs
use String Concatenation to create the query and it can’t accept input parameters Use setter methods to set the input parameters for the query
Suitable for DDL  Suitable for DML
Slower Faster
  Prevent SQL Injection attacks