List of usage examples for java.sql ResultSet deleteRow
void deleteRow() throws SQLException;
ResultSet
object and from the underlying database. From source file:Main.java
public static void main(String[] args) throws Exception { Connection conn = getConnection(); Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); st.executeUpdate("create table survey (id int,name varchar(30));"); st.executeUpdate("insert into survey (id,name ) values (1,'nameValue')"); st.executeUpdate("insert into survey (id,name ) values (2,null)"); st.executeUpdate("insert into survey (id,name ) values (3,'Tom')"); ResultSet rs = st.executeQuery("SELECT id,name FROM survey"); // Delete the first row rs.first();/*from w w w .j av a 2s . c o m*/ rs.deleteRow(); rs.close(); st.close(); conn.close(); }
From source file:Main.java
public static void main(String[] argv) throws Exception { String driverName = "com.jnetdirect.jsql.JSQLDriver"; Class.forName(driverName);//from w w w . j av a 2 s. c om String serverName = "127.0.0.1"; String portNumber = "1433"; String mydatabase = serverName + ":" + portNumber; String url = "jdbc:JSQLConnect://" + mydatabase; String username = "username"; String password = "password"; Connection connection = DriverManager.getConnection(url, username, password); // 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(); }
From source file:Main.java
public static void main(String[] args) throws Exception { try {// w w w .j av a 2s.c o m 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); } }
From source file:Main.java
public static void main(String[] args) throws Exception { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/testdb", "root", ""); Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); String query = "SELECT id, code, name, quantity, price FROM products"; ResultSet uprs = statement.executeQuery(query); while (uprs.next()) { System.out.println(uprs.getString("id") + ":" + uprs.getString("code") + ":" + uprs.getString("name") + ":" + uprs.getInt("quantity") + ":" + uprs.getDouble("price")); }// w w w. j a v a 2s .c o m uprs.first(); uprs.updateString("name", "Java"); uprs.updateRow(); uprs.next(); uprs.deleteRow(); uprs.moveToInsertRow(); uprs.updateString("code", "1"); uprs.updateString("name", "Data Structures"); uprs.updateInt("quantity", 1); uprs.updateDouble("price", 5.99); uprs.insertRow(); uprs.beforeFirst(); while (uprs.next()) { System.out.println(uprs.getString("id") + "\t" + uprs.getString("code") + "\t" + uprs.getString("name") + "\t" + uprs.getInt("quantity") + "\t" + uprs.getDouble("price")); } connection.close(); }
From source file:Main.java
public static void main(String[] args) { Connection conn = null;//from w w w . ja v a2 s.c o m Statement stmt = null; ResultSet rs = null; try { conn = getConnection(); String query = "select id, name from employees"; stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); rs = stmt.executeQuery(query); while (rs.next()) { String id = rs.getString(1); String name = rs.getString(2); System.out.println("id=" + id + " name=" + name); } rs.first(); rs.deleteRow(); rs.beforeFirst(); while (rs.next()) { String id = rs.getString(1); String name = rs.getString(2); System.out.println("id=" + id + " name=" + name); } } catch (Exception e) { e.printStackTrace(); System.exit(1); } finally { try { rs.close(); stmt.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } }
From source file:net.solarnetwork.node.dao.jdbc.AbstractBatchableJdbcDao.java
private BatchResult batchProcessInternal(final BatchCallback<T> callback, final BatchOptions options) { final String querySql = getBatchJdbcStatement(options); final AtomicInteger rowCount = new AtomicInteger(0); getJdbcTemplate().execute(new ConnectionCallback<Object>() { @Override/* ww w . j a v a2 s .c om*/ public net.solarnetwork.node.dao.BatchableDao.BatchResult doInConnection(Connection con) throws SQLException, DataAccessException { PreparedStatement queryStmt = null; ResultSet queryResult = null; try { queryStmt = con.prepareStatement(querySql, (options.isUpdatable() ? ResultSet.TYPE_SCROLL_SENSITIVE : ResultSet.TYPE_FORWARD_ONLY), (options.isUpdatable() ? ResultSet.CONCUR_UPDATABLE : ResultSet.CONCUR_READ_ONLY), ResultSet.CLOSE_CURSORS_AT_COMMIT); queryResult = queryStmt.executeQuery(); while (queryResult.next()) { T entity = getBatchRowEntity(options, queryResult, rowCount.incrementAndGet()); BatchCallbackResult rowResult = callback.handle(entity); switch (rowResult) { case CONTINUE: break; case STOP: return null; case DELETE: queryResult.deleteRow(); break; case UPDATE: case UPDATE_STOP: updateBatchRowEntity(options, queryResult, rowCount.intValue(), entity); queryResult.updateRow(); if (rowResult == BatchCallbackResult.UPDATE_STOP) { return null; } break; } } } finally { if (queryResult != null) { queryResult.close(); } if (queryStmt != null) { queryStmt.close(); } } return null; } }); return new BasicBatchResult(rowCount.intValue()); }
From source file:de.innovationgate.webgate.api.jdbc.custom.JDBCSource.java
public void removeContent(String folder, Object key) throws WGBackendException { ResultSet resultSet = null; try {//from w w w.j a v a 2 s. c om String whereClause = getWhereClause(folder, key); resultSet = getTableResultSet(folder, whereClause, true); if (resultSet != null) { startResultSet(resultSet); if (resultSet.next()) { resultSet.deleteRow(); if (getConnection().getAutoCommit() == false) { getConnection().commit(); } } else { throw new WGBackendException("Cannot remove row '" + key + "' of table '" + folder + "' because it cannot be retrieved"); } } } catch (SQLException e) { try { if (getConnection().getAutoCommit() == false) { getConnection().rollback(); } } catch (SQLException e1) { Logger.getLogger(LOGGER_NAME).error("Error rolling back content deletion", e); } throw new WGBackendException("Error removing row '" + key + "' of table '" + folder + "'", e); } finally { closeResultSet(resultSet); } }
From source file:net.pms.dlna.DLNAMediaDatabase.java
public void cleanup() { Connection conn = null;/* w w w. j a v a 2 s .c o m*/ PreparedStatement ps = null; ResultSet rs = null; try { conn = getConnection(); ps = conn.prepareStatement("SELECT COUNT(*) FROM FILES"); rs = ps.executeQuery(); dbCount = 0; if (rs.next()) { dbCount = rs.getInt(1); } rs.close(); ps.close(); PMS.get().getFrame().setStatusLine(Messages.getString("DLNAMediaDatabase.2") + " 0%"); int i = 0; int oldpercent = 0; if (dbCount > 0) { ps = conn.prepareStatement("SELECT FILENAME, MODIFIED, ID FROM FILES", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); rs = ps.executeQuery(); while (rs.next()) { String filename = rs.getString("FILENAME"); long modified = rs.getTimestamp("MODIFIED").getTime(); File file = new File(filename); if (!file.exists() || file.lastModified() != modified) { rs.deleteRow(); } i++; int newpercent = i * 100 / dbCount; if (newpercent > oldpercent) { PMS.get().getFrame() .setStatusLine(Messages.getString("DLNAMediaDatabase.2") + newpercent + "%"); oldpercent = newpercent; } } } } catch (SQLException se) { logger.error(null, se); } finally { close(rs); close(ps); close(conn); } }
From source file:com.github.woonsan.jdbc.jcr.impl.JcrJdbcResultSetTest.java
@Test public void testUnsupportedOperations() throws Exception { Statement statement = getConnection().createStatement(); ResultSet rs = statement.executeQuery(SQL_EMPS); try {/*from w ww. jav a2s . co m*/ rs.getWarnings(); fail(); } catch (UnsupportedOperationException ignore) { } try { rs.clearWarnings(); fail(); } catch (UnsupportedOperationException ignore) { } try { rs.getCursorName(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getObject(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getObject("ename"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.isLast(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.beforeFirst(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.afterLast(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.first(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.last(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.absolute(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.relative(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.previous(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.moveToCurrentRow(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNull(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNull("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBoolean(1, true); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBoolean("col1", true); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateByte(1, (byte) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateByte("col1", (byte) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateShort(1, (short) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateShort("col1", (short) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateInt(1, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateInt("col1", 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateLong(1, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateLong("col1", (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateFloat(1, (float) 0.1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateFloat("col1", (float) 0.1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateDouble(1, 0.1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateDouble("col1", 0.1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBigDecimal(1, new BigDecimal("100000000")); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBigDecimal("col1", new BigDecimal("100000000")); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateString(1, "Unknown"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateString("col1", "Unknown"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBytes(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBytes("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateDate(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateDate("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateTime(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateTime("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateTimestamp(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateTimestamp("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream(1, null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream("col1", null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream(1, null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream("col1", null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream(1, null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream("col1", null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateObject(1, null, 1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateObject("col1", null, 1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateObject(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateObject("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.insertRow(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateRow(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.deleteRow(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.refreshRow(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.cancelRowUpdates(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.moveToInsertRow(); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getObject(1, (Map<String, Class<?>>) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getObject("col1", (Map<String, Class<?>>) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getRef(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getRef("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getBlob(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getBlob("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getClob(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getClob("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getURL(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getURL("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateRef(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateRef("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBlob(1, (Blob) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBlob("col1", (Blob) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateClob(1, (Clob) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateClob("col1", (Clob) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateArray(1, (Array) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateArray("col1", (Array) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getRowId(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getRowId("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateRowId(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateRowId("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNString(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNString("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNClob(1, (NClob) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNClob("col1", (NClob) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getNClob(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getNClob("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getSQLXML(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getSQLXML("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateSQLXML(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateSQLXML("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getNString(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getNString("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getNCharacterStream(1); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getNCharacterStream("col1"); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNCharacterStream(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNCharacterStream(1, null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNCharacterStream("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNCharacterStream("col1", null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream(1, null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream("col1", null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream(1, null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream("col1", null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream(1, null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream("col1", null, (long) 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBlob(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBlob("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateClob(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateClob("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNClob(1, null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNClob("col1", null, 0); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNCharacterStream(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNCharacterStream("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateAsciiStream("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBinaryStream("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream(1, null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateCharacterStream("col1", null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBlob(1, (InputStream) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateBlob("col1", (InputStream) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateClob(1, (Reader) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateClob("col1", (Reader) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNClob(1, (Reader) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.updateNClob("col1", (Reader) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getObject(1, (Class<?>) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } try { rs.getObject("col1", (Class<?>) null); fail(); } catch (SQLFeatureNotSupportedException ignore) { } rs.close(); assertTrue(rs.isClosed()); statement.close(); assertTrue(statement.isClosed()); }