Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

execute() and executeQuery()

 
deepashree deval
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody tell me when shall I use the method execute() , executeQuery() what is the difference

[Updated Topic - Dave]
[ October 21, 2008: Message edited by: David O'Meara ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one returns a ResultSet and the other does not. If you want a ResultSEt (eg from a query) then use that one.
 
Brian Mozhdehi
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may also call Statement.getResultSet() if you choose to use execute() and the statement produces a ResultSet. executeQuery() is a conveience method when running SELECT statements as you of course are looking for a Result set usually in this case.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic