File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
executing an INSERT statement using a PreparedStatement
Joined: Jan 09, 2001
Jan 20, 2001 09:33:00
I was wondering if anyone knew which method of a PreparedStatement is best suited for an INSERT statement. Is the executeUpdate the best choice?
Joined: Jan 02, 2001
Jan 20, 2001 14:49:00
If you have a lot of insert, I would recommend using a batch insert. With a PreparedStatment, you would execute stmt.addBatch(), then a stmt.executeBatch() at the end.
Joined: May 05, 2000
Jan 22, 2001 07:24:00
For a single insert, you would use executeUpdate(). Remember that the main difference between executeUpdate() and executeQuery() is what they return. You could use executeQuery() to run an insert but you would get back an empty
Associate Instructor - Hofstra University
Amazon Top 750 reviewer
Blog - Unresolved References
Book Review Blog
I agree. Here's the link:
subject: executing an INSERT statement using a PreparedStatement
Difference between execute, executeQuery, executeUpdate
quotation mark problem
inserting text with single and doubl quotes
How you guys treat the " or ' fields inputs?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015