File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Updating/Inserting Multiple Tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Updating/Inserting Multiple Tables" Watch "Updating/Inserting Multiple Tables" New topic
Author

Updating/Inserting Multiple Tables

Bob Thorton
Greenhorn

Joined: Apr 25, 2011
Posts: 12

My current program wont properly Insert or Update a users information. For each I am getting a INSERT and UPDATE syntax error.



Not sure where I am going wrong. Is it possible something in my Access DB could be restricting me from inserting and updating?
Bob Thorton
Greenhorn

Joined: Apr 25, 2011
Posts: 12

Anyone have an idea of some sort of test I can run to see if I am doing something wrong somewhere
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Start using PreparedStatement instead of Statement. It will perform the escaping for you, and you will prevent SQL injection.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Bob Thorton
Greenhorn

Joined: Apr 25, 2011
Posts: 12

Couldnt not figure out how to properly implement the preparedstatement . plus im not sure i can even do that, unless somehow in the code i represent one of the strings as a New Customer
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Using Prepared Statements. Which is the first hit if you google on preparedstatement tutorial.
 
 
subject: Updating/Inserting Multiple Tables
 
Similar Threads
Inconsistant Code execution in jsp
Problem in inserting row in the database
batchupdate is not updating 1071 updates Urgent help required
Passing cent symbol from jsp to servlet -- Problem
Using Oracle package variables in JDBC.