Package org.postgresql.jdbc2

Examples of org.postgresql.jdbc2.AbstractJdbc2Statement


        }
    }

    public void testSerializable() throws IOException, ClassNotFoundException
    {
        ConnectionPool pool = new ConnectionPool();
        pool.setDefaultAutoCommit(false);
        pool.setServerName("db.myhost.com");
        pool.setDatabaseName("mydb");
        pool.setUser("user");
        pool.setPassword("pass");
        pool.setPortNumber(1111);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(pool);

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);
        ConnectionPool pool2 = (ConnectionPool)ois.readObject();

        assertEquals(pool.isDefaultAutoCommit(), pool2.isDefaultAutoCommit());
        assertEquals(pool.getServerName(), pool2.getServerName());
        assertEquals(pool.getDatabaseName(), pool2.getDatabaseName());
        assertEquals(pool.getUser(), pool2.getUser());
        assertEquals(pool.getPassword(), pool2.getPassword());
        assertEquals(pool.getPortNumber(), pool2.getPortNumber());
    }
View Full Code Here


     */
    protected void initializeDataSource()
    {
        if (bds == null)
        {
            bds = new ConnectionPool();
            setupDataSource(bds);
        }
    }
View Full Code Here

        }
    }

    public void testSerializable() throws IOException, ClassNotFoundException
    {
        ConnectionPool pool = new ConnectionPool();
        pool.setDefaultAutoCommit(false);
        pool.setServerName("db.myhost.com");
        pool.setDatabaseName("mydb");
        pool.setUser("user");
        pool.setPassword("pass");
        pool.setPortNumber(1111);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(pool);

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);
        ConnectionPool pool2 = (ConnectionPool)ois.readObject();

        assertEquals(pool.isDefaultAutoCommit(), pool2.isDefaultAutoCommit());
        assertEquals(pool.getServerName(), pool2.getServerName());
        assertEquals(pool.getDatabaseName(), pool2.getDatabaseName());
        assertEquals(pool.getUser(), pool2.getUser());
        assertEquals(pool.getPassword(), pool2.getPassword());
        assertEquals(pool.getPortNumber(), pool2.getPortNumber());
    }
View Full Code Here

     */
    protected void initializeDataSource()
    {
        if (bds == null)
        {
            bds = new ConnectionPool();
            setupDataSource(bds);
        }
    }
View Full Code Here

        }
    }

    public void testSerializable() throws IOException, ClassNotFoundException
    {
        ConnectionPool pool = new ConnectionPool();
        pool.setDefaultAutoCommit(false);
        pool.setServerName("db.myhost.com");
        pool.setDatabaseName("mydb");
        pool.setUser("user");
        pool.setPassword("pass");
        pool.setPortNumber(1111);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(pool);

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);
        ConnectionPool pool2 = (ConnectionPool)ois.readObject();

        assertEquals(pool.isDefaultAutoCommit(), pool2.isDefaultAutoCommit());
        assertEquals(pool.getServerName(), pool2.getServerName());
        assertEquals(pool.getDatabaseName(), pool2.getDatabaseName());
        assertEquals(pool.getUser(), pool2.getUser());
        assertEquals(pool.getPassword(), pool2.getPassword());
        assertEquals(pool.getPortNumber(), pool2.getPortNumber());
    }
View Full Code Here

     */
    protected void initializeDataSource()
    {
        if (bds == null)
        {
            bds = new PoolingDataSource();
            bds.setServerName(TestUtil.getServer());
            bds.setPortNumber(TestUtil.getPort());
            bds.setDatabaseName(TestUtil.getDatabase());
            bds.setUser(TestUtil.getUser());
            bds.setPassword(TestUtil.getPassword());
View Full Code Here

     * Check that 2 DS instances can't use the same name.
     */
    public void testCantReuseName()
    {
        initializeDataSource();
        PoolingDataSource pds = new PoolingDataSource();
        try
        {
            pds.setDataSourceName(DS_NAME);
            fail("Should have denied 2nd DataSource with same name");
        }
        catch (IllegalArgumentException e)
        {
        }
View Full Code Here

     */
    protected void initializeDataSource()
    {
        if (bds == null)
        {
            bds = new PoolingDataSource();
            setupDataSource(bds);
            ((PoolingDataSource) bds).setDataSourceName(DS_NAME);
            ((PoolingDataSource) bds).setInitialConnections(2);
            ((PoolingDataSource) bds).setMaxConnections(10);
        }
View Full Code Here

     * Check that 2 DS instances can't use the same name.
     */
    public void testCantReuseName()
    {
        initializeDataSource();
        PoolingDataSource pds = new PoolingDataSource();
        try
        {
            pds.setDataSourceName(DS_NAME);
            fail("Should have denied 2nd DataSource with same name");
        }
        catch (IllegalArgumentException e)
        {
        }
View Full Code Here

     */
    protected void initializeDataSource()
    {
        if (bds == null)
        {
            bds = new PoolingDataSource();
            bds.setServerName(TestUtil.getServer());
            bds.setPortNumber(TestUtil.getPort());
            bds.setDatabaseName(TestUtil.getDatabase());
            bds.setUser(TestUtil.getUser());
            bds.setPassword(TestUtil.getPassword());
View Full Code Here

TOP

Related Classes of org.postgresql.jdbc2.AbstractJdbc2Statement

Copyright © 2018 www.massapicom. 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.