Package javax.sql

Examples of javax.sql.ConnectionPoolDataSource


            throw new TorqueException(
                "Torque cannot be initialized without "
                    + "a valid configuration. Please check the log files "
                    + "for further details.");
        }
        ConnectionPoolDataSource cpds = initCPDS(configuration);
        TorqueClassicDataSource tcds = initTorqueClassic(configuration);
        tcds.setConnectionPoolDataSource(cpds);
        ds = tcds;
    }
View Full Code Here


            throw new TorqueException(
                "Torque cannot be initialized without a valid configuration. "
                + "Please check the log files for further details.");
        }

        ConnectionPoolDataSource cpds = initCPDS(configuration);
        PerUserPoolDataSource ds = initJdbc2Pool(configuration);
        ds.setConnectionPoolDataSource(cpds);
        this.ds = ds;
    }
View Full Code Here

     * with a <code>ConnectionPoolDataSource</code>.
     */
    public void embeddedTestAttributesAsPasswordWithoutPassword_pooled()
        throws Exception
    {
        ConnectionPoolDataSource ds =
            TestDataSourceFactory.getConnectionPoolDataSource();
        setDataSourceProperty(ds, "password", "mypassword");
        setDataSourceProperty(ds, "attributesAsPassword", Boolean.TRUE,
                              Boolean.TYPE);
        // DERBY-1586 caused a malformed url error here
        PooledConnection pc = ds.getPooledConnection();
        Connection c = pc.getConnection();
        c.close();
    }
View Full Code Here

     * password to be sent as a property string.
     */
    public void embeddedTestAttributesAsPasswordWithPassword_pooled()
        throws Exception
    {
        ConnectionPoolDataSource ds =
            TestDataSourceFactory.getConnectionPoolDataSource();
        setDataSourceProperty(ds, "attributesAsPassword", Boolean.TRUE,
                              Boolean.TYPE);
        try {
            PooledConnection pc =
                ds.getPooledConnection("username", "mypassword");
            fail("Expected getPooledConnection to fail.");
        } catch (SQLException e) {
            // expect error because of malformed url
            assertSQLState("XJ028", e);
        }
View Full Code Here

        Class[] argType = { Short.TYPE };
        String methodName = TestUtil.getSetterName(securityMechanismProperty);
        Object[] args = new Short[1];
        args[0] = secmec;
       
        ConnectionPoolDataSource cpds = getCPDS("wombat", user,password);
       
        // call setSecurityMechanism with secmec.
        Method sh = cpds.getClass().getMethod(methodName, argType);
        sh.invoke(cpds, args);
       
        // simulate case when connection will be re-used by getting
        // a connection, closing it and then the next call to
        // getConnection will re-use the previous connection. 
        PooledConnection pc = cpds.getPooledConnection();
        conn = pc.getConnection();
        conn.close();
        conn = pc.getConnection();
        test(conn);
        conn.close();
View Full Code Here

         *
         * @return a <code>Connection</code> value
         * @exception SQLException if an error occurs
         */
        protected Connection newConnection_() throws SQLException {
            ConnectionPoolDataSource ds = TestDataSourceFactory.getConnectionPoolDataSource();
            PooledConnection pc =
                ds.getPooledConnection(TestConfiguration.getCurrent().getUserName(),
                        TestConfiguration.getCurrent().getUserPassword());
            return pc.getConnection();
        }
View Full Code Here

    Connection con1 = null, con2 = null;

    try
    {
      System.out.println("TEST5 : Temporary tables declared in a pooled connection should get dropped when that pooled connection is closed");
      ConnectionPoolDataSource dsp;
      if (isDerbyNet) {
      /* following would require the IBM universal jdbc driver to be available during build...This section needs to be reworked for networkserver
        com.ibm.db2.jcc.DB2ConnectionPoolDataSource ds = new com.ibm.db2.jcc.DB2ConnectionPoolDataSource();
        ds.setDatabaseName("wombat");
        ds.setUser("cs");
        ds.setPassword("cs");
        hostName = TestUtil.getHostName();
        ds.setServerName(hostName);
        ds.setPortNumber(1527);
        ds.setDriverType(4);
        dsp = ds;
      */
        System.out.println("test will not build without universal driver");
        return passed;
     
      } else {
        EmbeddedConnectionPoolDataSource dscsp = new EmbeddedConnectionPoolDataSource();
        dscsp.setDatabaseName("wombat");
        //dscsp.setConnectionAttributes("unicode=true");
        dsp = dscsp;
      }

      PooledConnection pc = dsp.getPooledConnection();
      con1 = pc.getConnection();
      con1.setAutoCommit(false);
      Statement s = con1.createStatement();

      System.out.println(" In the first connection handle to the pooled connection, create physical session schema, create table t1 in it");
View Full Code Here

    p.put("connectionAttributes","create=true");
    p.put("user","APP");
    p.put("password","pw");
   
        // Test holdability  
        ConnectionPoolDataSource ds = TestUtil.getConnectionPoolDataSource(p);
        pc1 = ds.getPooledConnection();
        testPooledConnHoldability("PooledConnection", pc1);
        pc1.close();
       
        // Test autocommit
        pc1 = ds.getPooledConnection();
        testPooledConnAutoCommit("PooledConnection", pc1);
        pc1.close();
       
        // Test pooled connection isolation
    ds = TestUtil.getConnectionPoolDataSource(p);
    pc1 = ds.getPooledConnection();
    testPooledConnIso("PooledConnection" , pc1);  
        pc1.close();
      
        // Test xa connection isolation
    XADataSource xds = TestUtil.getXADataSource(p);
View Full Code Here

     */
    public void testConnectionErrorEvent() throws SQLException, Exception
    {
        AssertEventCatcher aes12 = new AssertEventCatcher(12);
       
        ConnectionPoolDataSource ds = J2EEDataSource.getConnectionPoolDataSource();

        PooledConnection pc = ds.getPooledConnection();
        //Add a connection event listener to ConnectionPoolDataSource
        pc.addConnectionEventListener(aes12);
        Connection conn = pc.getConnection();
       
        dropTable(conn, "TAB1");
View Full Code Here

    /**
     * Test that event notification doesn't fail when a null listener has
     * been registered (DERBY-3307).
     */
    public void testConnectionEventListenerIsNull() throws SQLException {
        ConnectionPoolDataSource cpds =
            J2EEDataSource.getConnectionPoolDataSource();
        subtestCloseEventWithNullListener(cpds.getPooledConnection());
        subtestErrorEventWithNullListener(cpds.getPooledConnection());

        XADataSource xads = J2EEDataSource.getXADataSource();
        subtestCloseEventWithNullListener(xads.getXAConnection());
        subtestErrorEventWithNullListener(xads.getXAConnection());
    }
View Full Code Here

TOP

Related Classes of javax.sql.ConnectionPoolDataSource

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.