This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Starter Question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Starter Question." Watch "Starter Question." New topic
Author

Starter Question.

rama murthy
Ranch Hand

Joined: Jan 13, 2006
Posts: 82
Are the following statements correct.


For DML (Data Manipulation Language) statements like update, insert, delete we use the method executeUpdate.

For select statement we use executeQuery which returns a ResultSet instance.
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
Sort of yes.

There are times and ways you could use execute() instead, but for beginners (and for most of general purpose code), that's the way to do it.

Beginners should also start with using PreparedStatement, instead of Statement. Many people have the idea that Statement is easier, and therefore should be learned first, but Statement has all sorts of problems and really shouldn't be used much at all...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Starter Question.
 
Similar Threads
Constants and static final Wrapper Objects
DB2 Views and Stored Procedures
Callable Statements
logging in java
Why servlet in WebApplication