A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
not able to insert values
Joined: Oct 31, 2007
Mar 26, 2008 00:57:00
i am not able to insert values in the database is the query correct ???
String query = ("INSERT INTO kdnet.users VALUES ('"+firstName+"', '"+lastName+"', '"+citiicode1+"','"+address1+"','"+state+"')"); stmt.executeUpdate(query); rset = stmt.executeQuery(query); conn.commit(); rset.close(); stmt.close(); conn.close();
Joined: Oct 23, 2005
Mar 26, 2008 05:23:00
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 (?,?,?,?,?)".
Down Home Country Coding with Scott Selikoff
Joined: Nov 25, 2007
Mar 26, 2008 05:54:00
please list out the exact error you are getting after execution of this code.
I agree. Here's the link:
subject: not able to insert values
insert query working in toad and giving error in jdbc
storing date in database
oracle date between
IllegalStateException when inserting session attribute into a table
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014