creating the statement object

Example
/* local variables */ int sid 10; String sname = “Yuppy”; int rating = 5; float age = 40.0;
/* creating the statement object */ String sql=”INSERT INTO Sailors VALUES(?,?,?,?)”; PreparedStatment pstmt=conn.prepareStatement(sql);
Example (contd.)
/* initialize parameters */ pstmt.clearParameters(); pstmt.setlnt( I ,sid); pstmt.setString(2,sname); pstmt.setlnt(3, rating); pstmt.setFloat(4,age);
12/19
/* no results will be returned, use executeUpdate() metho int numRows = pstmt.executeUpdate();
► executeUpdate() returns the number of affected records
Retrieving Data: ResultSet class