June 2017
Beginner
1296 pages
69h 23m
English
... , email);
114 insertNewPerson.setString(4, phoneNumber);
115
116 return insertNewPerson.executeUpdate();
117 }
118 catch (SQLException sqlException) {
119 sqlException.printStackTrace();
120 return 0;
121 }
122 }
123
124 // close the database connection
125 public void close() {
126 try {
127 connection.close();
128 }
129 catch (SQLException sqlException) {
130 sqlException.printStackTrace();
131 }
132 }
133 }
PreparedStatements used by the Address Book application.
PreparedStatementsLines 28–29 invoke Connection method prepareStatement to create the Prepared-Statement selectAllPeople that selects all the rows in the Addresses table and sorts them by last name, then by first name. Lines 33–35 create the PreparedStatement selectPeopleByLastName ...