Cara mengeksekusi pernyataan SQL Select
// jdbc select from
PreparedStatement selectStatement = connection.prepareStatement("select * from users where first_name = ?");
selectStatement.setString(1, "John");
// this will return a ResultSet of all users with said name
ResultSet rs = selectStatement.executeQuery();
// will traverse through all found rows
while (rs.next()) {
String firstName = rs.getString("first_name");
String lastName = rs.getString("last_name");
System.out.println("firstName = " + firstName + "," + "lastName= " + lastName );
}
Homeless Hamerkop