aspose file tools
The moose likes JDBC and the fly likes PreparedStatements and precompiled? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply 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: 3268

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: 3268

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: PreparedStatements and precompiled?
 
Similar Threads
Hibernate cfg xml and Eclipse problem
Simple jdbc program error
JNDI exception when creating dataSource
problem with jboss can any one help?
javax.sql.RowSet, Oracle JDBC