Java examples for JDBC:ResultSet
Deleting a Row from a Database Table Using an Updatable Result Set
import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Main { public void myMethod() { try {// ww w . ja v a 2s . co m Connection connection = null; // Create an updatable result set Statement stmt = connection.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet resultSet = stmt.executeQuery("SELECT * FROM my_table"); // Delete the first row resultSet.first(); resultSet.deleteRow(); } catch (SQLException e) { } } }