Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and Relational Databases 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 Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 20083
    
  30

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 - OCEJPAD 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: 20083
    
  30

Using Prepared Statements. Which is the first hit if you google on preparedstatement tutorial.
 
Have you checked out Aspose?
 
subject: Updating/Inserting Multiple Tables
 
It's not a secret anymore!