Skip to main content

Q) What are the difference between statement and Prepared-statement?



A)

Statement
Prepared Statement
It is used for submitting any kind of SQL statement, but for only once.
When same SQL statement required to be submitted repeatedly.
Statement object is empty.
It holds a pre-compiled SQL statement.
No place holders allowed in submitted SQL statement.
At least one place holder mandatory.
Java.sql.Statement is a parent interface of PreparedStatement
Java.sql.PreparedStatement is a sub interface of Statement.

Comments