The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Adv & Dis

Posted by Senthoor on December 14, 2001 at 10:06 PM

CallableStatement have advantage over statment.execute(). If you go through the JDBC API you would understand CallableStatements are inherited from PreparedStatements.

In Databases everytime a query is executed a plan is created for that query. If the same query is executed again the plan isretrived from the database using the Query as the Key. So next time if the same query is executed even with a different value in the where condition it is treated as a different query by the DB and a different plan is created. In order to aviod this only PreparedStatement are introduced. Which increases the performance by cahsing the Query plan and and not creating it everything...

I don't think Statement has that facility. This is he case when it comes to normal SQL statements embadded in the Java Code.

However what you are trying to execute is a backEnd SP through CallableStatement. ASo if the Backend does the necesasary to make sure it cashes the SP query plan I am not sure whether it makes any difference whether you use Statement or CallableStatement.

in IBM's developerworks site under JDBC you should find enough meterial explain thesetopic I guess

Senthoor





Replies:
  • thanx again stunning December 16, 2001 at 8:30 PM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us