Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes Problem with Stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem with Stored procedure" Watch "Problem with Stored procedure" New topic
Author

Problem with Stored procedure

Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
Is there a performance difference using CallableStatement and Prepared Statements
[ May 11, 2005: Message edited by: Richard Vagner ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30050
    
149

Richard,
executeUpdate() is for inserts/deletes/updates. It returns an int value representing the number of rows changed. executeQuery() returns the resultset and is used for selects.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30050
    
149

Looks like the question changed since I answered it. Richard, its ok to leave the original question and start a new thread for a new topic.

A CallableStatement is for a stored proc that is executed on the database server. A PreparedStatement is for pre-compiled SQL. It's hard to compare the performance since they are different things. Stored procs are typically faster, although it is not always by enough to worry about the difference.
 
Don't get me started about those stupid light bulbs.
 
subject: Problem with Stored procedure