This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes execute() vs executeUpdate() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "execute() vs executeUpdate()" Watch "execute() vs executeUpdate()" New topic
Author

execute() vs executeUpdate()

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

Hi,

May I know what is the difference betweet execute() and executeUpdate().
As far as I know executeUpdate() dont support select statements. execute() supporots all.

If any, please let me know.

Regards,

rahul.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Another main difference in these execute() methods is about returning the value by execute these methods.

like:

execute() It returns boolean value

executeQuery() it returns resultset

executeUpdate() It returns integer


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3712
    
    5

Generally speaking you almost always use executeUpdate or executeQuery since execute() by itself does not give you much information. I'd recommend consulting the APIs for more details.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: execute() vs executeUpdate()