Results 1 to 1 of 1
String values in SQL queries are written in quotes. One has to use escape characters for that purpose which is tricky. If we use PreparedStatement, then JDBC handles the escaping for us.
PreparedStatement ps; ps = conn.prepareStatement ( "INSERT INTO students(name, address) VALUES(?,?)"); ps.setString (1, name; ps.setString (2, address); int count = ps.executeUpdate (); ps.close ();
- By Java Tip in forum Java TipReplies: 0Last Post: 02-10-2008, 12:39 PM
- By Java Tip in forum Java TipReplies: 0Last Post: 02-06-2008, 10:30 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 12-22-2007, 12:24 PM
- By Felissa in forum JDBCReplies: 2Last Post: 06-28-2007, 05:03 PM