Package javax.sql.rowset

Examples of javax.sql.rowset.JdbcRowSet.execute()


            fail("Shuld throw NullPointerException since jrs has not been executed.");
        } catch (NullPointerException e) {
            // Expected.
        }

        jrs.execute();

        try {
            jrs.rollback(null);
            fail("Should throw SQLException since autoCommit is on");
        } catch (SQLException e) {
View Full Code Here


        } catch (NullPointerException e) {
            // expected
        }
        jrs.setUrl(DERBY_URL);
        try {
            jrs.execute();
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
        /*
 
View Full Code Here

            jrs.setUrl(null);
            assertEquals(DERBY_URL, jrs.getUrl());
        }

        jrs.setCommand("SELECT * FROM USER_INFO");
        jrs.execute();
        assertTrue(jrs.last());
        assertEquals(4, jrs.getInt(1));
        jrs.close();

        /*
 
View Full Code Here

         * recall execute() after close()
         */
        assertEquals("SELECT * FROM USER_INFO", jrs.getCommand());
        assertEquals(DERBY_URL, jrs.getUrl());
        try {
            jrs.execute();
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected, No current connection.
        }

View Full Code Here

        jrs.clearParameters();
        assertEquals("SELECT * FROM USER_INFO", jrs.getCommand());
        assertEquals(DERBY_URL, jrs.getUrl());
        try {
            jrs.execute();
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }

View Full Code Here

        jrs = newJdbcRowSet();
        jrs.setUrl(DERBY_URL);
        jrs.setCommand("SELECT * FROM USER_INFO WHERE ID >= ?");
        jrs.setInt(1, 2);
        jrs.execute();
        assertTrue(jrs.first());
        assertEquals(2, jrs.getInt(1));

        // change the query condition
        jrs.setInt(1, 3);
View Full Code Here

        assertTrue(jrs.first());
        assertEquals(2, jrs.getInt(1));

        // change the query condition
        jrs.setInt(1, 3);
        jrs.execute();
        assertTrue(jrs.first());
        assertEquals(3, jrs.getInt(1));

        // change the command
        jrs.setCommand("SELECT * FROM USER_INFO WHERE NAME = 'hermit'");
View Full Code Here

        assertTrue(jrs.first());
        assertEquals(3, jrs.getInt(1));

        // change the command
        jrs.setCommand("SELECT * FROM USER_INFO WHERE NAME = 'hermit'");
        jrs.execute();
        assertTrue(jrs.first());
        assertEquals(1, jrs.getInt(1));
        assertFalse(jrs.next());

        jrs.close();
View Full Code Here

    public void testExecute_SelectCmd() throws Exception {
        JdbcRowSet jrs = newJdbcRowSet();
        jrs.setCommand("SELECT * FROM USER_INFO WHERE ID > ?");
        jrs.setUrl(DERBY_URL);
        jrs.setInt(1, 1);
        jrs.execute();

        assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, jrs.getType());
        assertEquals(ResultSet.CONCUR_UPDATABLE, jrs.getConcurrency());
        assertTrue(jrs.getAutoCommit());
        assertTrue(jrs.first());
View Full Code Here

        jrs.setCommand("Update User_INFO set Name= ? Where ID= ? ");
        jrs.setUrl(DERBY_URL);
        jrs.setString(1, "update");
        jrs.setInt(2, 3);
        try {
            jrs.execute();
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
        jrs.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.