Code example for ResultSet

Methods: close, getMetaData

0
            st1.executeUpdate(create);
            st1.executeUpdate(insert1);
            st1.executeUpdate(insert2);
 
            rs1 = st1.executeQuery(query);
            assertNotNull(rs1);
            ResultSetMetaData rsmd1 = rs1.getMetaData();
            assertEquals("zoo", rsmd1.getTableName(1));
            assertEquals("hutch", rsmd1.getTableName(2));
        } catch (SQLException e) {
            fail("SQLException is thrown: " + e.getMessage());
        } finally { 
            try { 
                if (rs1 != null) rs1.close();
                if (st1 != null) {
                    st1.executeUpdate("drop table if exists hutch");
                    st1.close();
                } 
            } catch (SQLException sqle) {
            } 
        }