wood burning stoves 2.0*
The moose likes JDBC and the fly likes precompilation of PreparedStatements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "precompilation of PreparedStatements" Watch "precompilation of PreparedStatements" New topic
Author

precompilation of PreparedStatements

Pushker Chaubey
Ranch Hand

Joined: Dec 06, 2006
Posts: 53
What do we mean by precompiled nature of preparedstatements? where are these statements complied and stored?


Regards,<br />Pushker<br /> <br />SCBCD 5.0 90%<br />SCWCD 5.0 89%<br />SCJP 5.0 90%
Joice Jose
Greenhorn

Joined: Jun 29, 2005
Posts: 14
PreparedStatement is more efficient than Statement object if you are executing similar statements multiple times. When a PreparedStatement is created, the SQL statement is sent to the database for precompilation. The precompiled form of a prepared statement is cached only as long as the PreparedStatement instance is alive, so the performance benefits are only obtained when reusing the same PreparedStatement instance, setting different parameters on each invocation.
Joice Jose
Greenhorn

Joined: Jun 29, 2005
Posts: 14
Check this
Chris Hendy
Ranch Hand

Joined: Mar 04, 2006
Posts: 98
This depends on the database.

Oracle for instance will cache parsed SQL and execution plans in its own shared memory area. They will stay there even if the session that first submitted it drops the connection, unless and until they are aged out by more recently requested statements needing the space.
[ December 12, 2006: Message edited by: Chris Hendy ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: precompilation of PreparedStatements
 
Similar Threads
Prepared Statements
Filtering Data to prevent SQL Injection
How this code can be improved?
Why we can't share PreparedStatement cache across connections
values not been inserted