ResultSet: deleteRow()
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class Main {
public static void main(String[] args) throws Exception {
try {
String url = "jdbc:odbc:yourdatabasename";
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String user = "guest";
String password = "guest";
Class.forName(driver);
Connection connection = DriverManager.getConnection(url, user, password);
Statement stmt = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("SELECT * from DUMMY");
System.out.println(rs.getType());
System.out.println(rs.getConcurrency());
rs.deleteRow();
rs.close();
rs.close();
stmt.close();
connection.close();
} catch (Exception e) {
System.err.println(e);
}
}
}
Related examples in the same category