Código
public void agregar() { try{ Class.forName(driver); con.setAutoCommit(false); ResultSet rs = stmt.executeQuery("insert into alumno values('"+tnomb.getText()+"','"+tapa.getText()+"','"+tama.getText()+"','"+tmate.getText()+"');"); con.commit(); con.setAutoCommit(true); while (rs.next()){ } stmt.close(); con.close(); con.rollback(); } } }