• Post Reply Bookmark Topic Watch Topic
  • New Topic

execute() vs executeUpdate()

 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Scott Selikoff
author
Bartender
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!