import java.awt.*; import java.awt.event.*; import java.util.*; import java.sql.*; public class CursorExample extends Frame { public CursorExample () { super("CursorExample"); this.setSize(300, 300); this.setVisible( true ); //Add ActionListener para Fechar Aplicacao this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); try { String driverName = "sun.jdbc.odbc.JdbcOdbcDriver"; Driver driver = (Driver)Class.forName(driverName).newInstance(); Properties p = new Properties(); p.put("user", "p8cp1"); p.put("password", "ismael"); String dbURL = "jdbc:odbc:fiaa"; Connection connection = driver.connect(dbURL, p); System.out.println("--- Conection established ---"); // Create the SQL to get employees Statement sqlStatement = connection.createStatement(); String sql = "select * from Pessoa"; // Get the employees ResultSet records = sqlStatement.executeQuery(sql); // Call the next method to place cursor on initial record records.next(); // Build the string to delete the initial record sql = "delete from Pessoa where current of " + records.getCursorName(); sqlStatement.executeUpdate(sql); } catch (SQLException e) {} catch (Exception e) {} } public static void main (String args[]) { CursorExample app = new CursorExample(); } }