dcsimg
<p>!_NEWLINE_!performance issues in PreparedStatement and createstatement!_NEWLINE_!in jdbc!_NEWLINE_!</p>
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   manoj_kumar
Posted On:   Tuesday, August 20, 2002 11:28 AM

In terms of performance issues which is better way of executing SQL prepared statement or createstatement.
Pls do explain in detail as to the advantages and disadvantages soully based on performance issues.

Re: <p>!_NEWLINE_!performance issues in PreparedStatement and createstatement!_NEWLINE_!in jdbc!_NEWLINE_!</p>

Posted By:   Lasse_Koskela  
Posted On:   Tuesday, August 20, 2002 02:19 PM

If you are referring to Statement's ("createStatement") and PreparedStatement's, the answer is in almost every situation that PreparedStatement behaves better regarding performance.


This is due to the nature of PreparedStatement's: they are pre-compiled and reused by the JDBC driver. When you're using Connection.createStatement(), you are creating a new object for each SQL statement.


The biggest gap comes in situations where a similar SQL statement is executed several times in a row (as in a batch of statements) for the reasons mentioned above.


You could probably find several articles discussing the pro's and con's of using PreparedStatement vs. Statement around the Internet...


It's too late where I'm living, so please correct my half-a-sleep errors :)

About | Sitemap | Contact