Package org.h2.jdbcx

Examples of org.h2.jdbcx.JdbcConnectionPool.dispose()


        cp.setLogWriter(new PrintWriter(w));
        Connection conn1 = cp.getConnection();
        Connection conn2 = cp.getConnection();
        conn1.close();
        conn2.createStatement().execute("shutdown immediately");
        cp.dispose();
        assertTrue(w.toString().length() > 0);
        cp.dispose();
    }

    private void testWrongUrl() {
View Full Code Here


        Connection conn2 = cp.getConnection();
        conn1.close();
        conn2.createStatement().execute("shutdown immediately");
        cp.dispose();
        assertTrue(w.toString().length() > 0);
        cp.dispose();
    }

    private void testWrongUrl() {
        JdbcConnectionPool cp = JdbcConnectionPool.create("jdbc:wrong:url", "", "");
        try {
View Full Code Here

        try {
            cp.getConnection();
        } catch (SQLException e) {
            assertEquals(8001, e.getErrorCode());
        }
        cp.dispose();
    }

    private void testTimeout() throws Exception {
        String url = getURL("connectionPool", true), user = getUser(), password = getPassword();
        final JdbcConnectionPool man = JdbcConnectionPool.create(url, user, password);
View Full Code Here

        } finally {
            conn.close();
            t.get();
        }

        man.dispose();
    }

    private void testUncommittedTransaction() throws SQLException {
        String url = getURL("connectionPool", true), user = getUser(), password = getPassword();
        JdbcConnectionPool man = JdbcConnectionPool.create(url, user, password);
View Full Code Here

        Connection conn2 = man.getConnection();
        assertTrue(conn2.getAutoCommit());
        conn2.close();

        man.dispose();
    }

    private void testPerformance() throws SQLException {
        String url = getURL("connectionPool", true), user = getUser(), password = getPassword();
        JdbcConnectionPool man = JdbcConnectionPool.create(url, user, password);
View Full Code Here

        int len = 1000;
        long time = System.currentTimeMillis();
        for (int i = 0; i < len; i++) {
            man.getConnection().close();
        }
        man.dispose();
        trace((int) (System.currentTimeMillis() - time));
        time = System.currentTimeMillis();
        for (int i = 0; i < len; i++) {
            DriverManager.getConnection(url, user, password).close();
        }
View Full Code Here

        conn.close();
        conn = man.getConnection();
        stat = conn.createStatement();
        stat.execute("select * from test");
        conn.close();
        man.dispose();
    }

    private void testThreads() throws Exception {
        final int len = getSize(4, 20);
        final JdbcConnectionPool man = getConnectionPool(len - 2);
View Full Code Here

        stop[0] = true;
        for (int i = 0; i < len; i++) {
            threads[i].join();
        }
        assertEquals(0, man.getActiveConnections());
        man.dispose();
    }

    private JdbcConnectionPool getConnectionPool(int poolSize) {
        JdbcDataSource ds = new JdbcDataSource();
        ds.setURL(getURL("connectionPool", true));
View Full Code Here

        JdbcConnectionPool pool = getConnectionPool(3);
        for (int i = 0; i < 100; i++) {
            Connection conn = pool.getConnection();
            conn.close();
        }
        pool.dispose();
        DataSource ds = pool;
        assertThrows(IllegalStateException.class, ds).
                getConnection();
        assertThrows(UnsupportedOperationException.class, ds).
                getConnection(null, null);
View Full Code Here

        return qr;
    }

    public void dispose() {
        JdbcConnectionPool pool = (JdbcConnectionPool) qr.getDataSource();
        pool.dispose();
    }
}
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.