INSERT Statements
To insert into a table, use the standard INSERT SQL syntax.
String cmd = "INSERT INTO Account (AcctName) VALUES (?)";
PreparedStatement pstmt = connection.prepareStatement(cmd,Statement.RETURN_GENERATED_KEYS);
pstmt.setString(1, "Petty Cash");
int count = pstmt.executeUpdate();
System.out.println(count+" rows are affected");
ResultSet rs = pstmt.getGeneratedKeys();
while(rs.next()){
System.out.println(rs.getString("Id"));
}
connection.close();