This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes exact differenece ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 2904

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: 3753

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 ]

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: exact differenece ??
It's not a secret anymore!