aspose file tools*
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
Author

exact differenece ??

Amit Kumar S
Greenhorn

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
    
    1

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: 3704
    
    5

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exact differenece ??