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, 11:39 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 02-06-2008, 09:30 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 12-22-2007, 11:24 AM
- By Felissa in forum JDBCReplies: 2Last Post: 06-28-2007, 05:03 PM