File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes SQL statements 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 "SQL statements" Watch "SQL statements" New topic

SQL statements

vasu narayana

Joined: Oct 31, 2005
Posts: 3
difference between executeUpdate() and executeQuery() and what are the
JDBC exception?

regards<br /> vasu
Makarand Parab
Ranch Hand

Joined: Dec 10, 2004
Posts: 121

If you are working with insert, delete and update sql statement which returns the count, you would be working with executeupdate(). Mostly all DML statements.

If you are working with select sql statement, which returns resultset, you would be working with executeQuery().

Both of them throw SQLException.

Let me know if i am wrong.

Makarand Parab
vasu narayana

Joined: Oct 31, 2005
Posts: 3
hi thanks for ur reply.. i had cleared abt diff b/w executeUpdate n execute query .. one more question is .. tell me the jdbc exception types
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
For your first question, you should have read the docs.
Now, please read the docs. There is no other better substitute.
I agree. Here's the link:
subject: SQL statements
It's not a secret anymore!