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
How can I determine the isolation levels supported by my DBMS?
How many jdbc driver types are there?
How MS-Access DB can be accessed over a network, using JDBC API?
Is there another way of dealing with the result set that could execute faster?
I have the choice of manipulating database data using a byte[] or a java.sql.blob. Which has best performance?
How do I insert an image file (or other raw data) into a database?
How many locking systems are there in jdbc?
What do you mean by jdbc batch processing and what are the advantages of using jdbc batch processing?
How to connect multiple database in jdbc?
Give an example for execution of sql statement.
What is meant by jdbc and odbc?
What is JDBC RowSet? What are different types of RowSet?
Why do we need jdbc api?
What is jdbc driver?
How does jdbc connect to database?