Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

INSERT INTO statement in java servlet.

843859Feb 20 2007 — edited Feb 25 2007
Hiya

Was wondering if anyone knew how to use variables from an html form into a sql insert into statement? The constants work ok below, its just getting the variables to work.




//constants work ok.
rs = stmt.executeQuery("INSERT INTO ACCOUNTS " + " VALUES ('un', 'test2', 'test2', 'test2', 'test', 'test', 'test', 'test', 'test')");




//doesn't do anything no errors.

rs = stmt.executeQuery("INSERT INTO ACCOUNTS " + " VALUES ( '"+uname+"', " + " '"+fname+"', " + " '"+sname+"'," + "'"+address1+"'," + "'"+address2+"'," + "'"+town+"'," + "'"+county+"'," + "'"+postcode+"')");
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2007
Added on Feb 20 2007
11 comments
832 views