What is PreparedStatement?

Answer Posted / guest

There's a popular belief that using a PreparedStatement
object is faster than using a Statement object. After all, a
prepared statement has to verify its metadata against the
database only once, while a statement has to do it every
time. So how could it be any other way? Well, the truth of
the matter is that it takes about 65 iterations of a
prepared statement before its total time for execution
catches up with a statement. This has performance
implications for your application, and exploring these
issues is what this section is all about.

When it comes to which SQL statement object performs better
under typical use, a Statement or a PreparedStatement, the
truth is that the Statement object yields the best
performance. When you consider how SQL statements are
typically used in an application--1 or 2 here, maybe 10-20
(rarely more) per transaction--you realize that a Statement
object will perform them in less time than a
PreparedStatement object. In the next two sections, we'll
look at this performance issue with respect to both the OCI
driver and the Thin driver.

Is This Answer Correct ?    0 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I know when I reach the last record in a table, since JDBC doesn't provide an EOF method?

585


Describe odbc?

554


What packages are used by jdbc?

501


What are the classes and methods used for sending sql statements to database?

536


Does the database server have to be running Java or have Java support in order for my remote JDBC client app to access the database?

518






DB2 Universal claims to support JDBC 2.0, But I can only get JDBC 1.0 functionality. What can I do?

582


What is the meaning of “dirty read” in the database?

563


There is a method getColumnCount in the JDBC API. Is there a similar method to find the number of rows in a result set?

612


What does the jdbc connection interface?

534


password, is stored in as plain text. What can I do to protect my passwords?

513


What are jdbc?

544


Is there another way of dealing with the result set that could execute faster?

516


How many types of jdbc drivers are there?

549


List some new features available in jdbc 4.0?

475


What port does jdbc use?

490