up previous next contents
Next: A real method Up: Databases and JDBC Previous: Updating the database   Contents

PreparedStatements

  • Developers often use PreparedStatements because the syntax is easier.
  • Example:
      PreparedStatement update = 
         conn.prepareStatement("UPDATE user SET password = ? WHERE user = ?");
      updateSales.setString(1, "bar");
      updateSales.setString(2, "foo");
    
  • Intended for, most useful, and high performance, inside of loops where many INSERT's or UPDATE's need to be done at one time.


up previous next contents
Next: A real method Up: Databases and JDBC Previous: Updating the database   Contents