It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes not able to insert values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "not able to insert values" Watch "not able to insert values" New topic

not able to insert values

anwesh maity

Joined: Oct 31, 2007
Posts: 20
i am not able to insert values in the database is the query correct ???

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3749

Use PreparedStatements!!!

If you have a single quote in any of those strings (John O'Conner) its going to die. Your query with PreparedStatements should then just be "INSERT INTO kdnet.users VALUES (?,?,?,?,?)".

[OCA 8 Book] [Blog]
Minal Silimkar-Urankar
Ranch Hand

Joined: Nov 25, 2007
Posts: 136
please list out the exact error you are getting after execution of this code.

Minal Silimkar
I agree. Here's the link:
subject: not able to insert values
It's not a secret anymore!