jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes execute() vs executeUpdate() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "execute() vs executeUpdate()" Watch "execute() vs executeUpdate()" New topic

execute() vs executeUpdate()

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401


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.


Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1323

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


execute() It returns boolean value

executeQuery() it returns resultset

executeUpdate() It returns integer

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

Joined: Oct 23, 2005
Posts: 3753

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.

[OCA 8 Book] [Blog]
I agree. Here's the link: http://aspose.com/file-tools
subject: execute() vs executeUpdate()
jQuery in Action, 3rd edition