| Author |
JDBC statements
|
Shivaprakash Shettihalli
Greenhorn
Joined: Nov 20, 2007
Posts: 18
|
|
|
What the advantage of using Statement over Prepared Statement, not the reverse please
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Unlike a prepared statement, which has to be known ahead of time, a statement can take any string and try to execute it as a SQL statement. This is useful for programs that build SQL statement on the fly or that have to execute accept statements passed to it from other programs or components. It should go without saying that this can be dangerous thing in certain environments (you originally asked this question in the servlets forum), if your code accepts SQL strings (or pieces of SQL Strings) from untrusted clients.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Statements are usually faster than PreparedStatements if you cannot reuse PreparedStatements. If you can, it determines on the number of times the PreparedStatement can be reused.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: JDBC statements
|
|
|