There are two things you need to do to write a prepared statement in Java. First your going to need an SQL string with ?s in place of the values. Second we add the values to the statement by calling the set methods of the preparedstatement. PreparedStatement.setString(1, AnyStringData) will set the first question mark in the SQL string with “AnyStringData”.
//Untested Pseudo Code && Ugly method public void makePreparedStatement(Connection connect) //SQL String String sql = "UPDATE MEMBERS SET NAME = ? WHERE ID = ?"; PreparedStatement ps = connect.prepareStatement(sql); ps.setString(1, Dan); //Value for the ? at the Name field ps.setInt(2, 1); // Value for the ? at the ID field