File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes PreparedStatements and precompiled? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "PreparedStatements and precompiled?" Watch "PreparedStatements and precompiled?" New topic
Author

PreparedStatements and precompiled?

Brij Garg
Ranch Hand

Joined: Apr 29, 2008
Posts: 234
Hi,


Prepared Statements aren't actually compiled, but they are bound by the JDBC driver


What we mean by "bound by the JDBC driver"?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

It means that some (not all) JDBC drivers will bind your parameter to the appropriate table column early/upfront and keep that binding (so it's not repeated each time the prepared statement is executed). It's a performance enhancement basically.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Brij Garg
Ranch Hand

Joined: Apr 29, 2008
Posts: 234
Thanks.

Is binding and precompiling are one and same thing or they have different meaning?
If they are different then how?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

They have different meanings, in fact one is used within the other (for PreparedStatements).

Precompiling is a step that involves preparing the SQL statement for execution on the Database server, you often want to do this if the SQL is going to be executed more than once. Binding forms part (but not all) of that precompilation step.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PreparedStatements and precompiled?
 
Similar Threads
Simple jdbc program error
JNDI exception when creating dataSource
javax.sql.RowSet, Oracle JDBC
Hibernate cfg xml and Eclipse problem
problem with jboss can any one help?