File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes exact differenece ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "exact differenece ??" Watch "exact differenece ??" New topic

exact differenece ??

Amit Kumar S

Joined: Jun 27, 2008
Posts: 3
What is the difference between executeQuery() and executeUpdate()
I mean what database operations possible in both the cases ?
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902

I think Javadoc is enough to explain the difference !!

See this !

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697

Technically speaking: you can execute whatever you want. JDBC will not validate your queries. The general rule of thumb though is to use executeQuery for SELECT statements and executeUpdate for INSERT/UPDATE statements. Also, look at the return value of each in the API as Sagar suggested.
[ July 01, 2008: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
wood burning stoves
subject: exact differenece ??
Similar Threads
Software Life
I Always Wanna Post Java Related Topics
World Market
WA #2 ..... word association