Package javax.sql

Examples of javax.sql.ConnectionPoolDataSource


     * Test that a JDBC 3 data source returns a JDBC 4 PooledConnection
     * when running with a JDBC 4 JDK.
     */
    public void testPooledConnection() throws Exception
    {
        ConnectionPoolDataSource ds = J2EEDataSource.getConnectionPoolDataSource();

        checkJDBC4Interface(ds.getPooledConnection());
    }
View Full Code Here


        // In order to run this test, a special permission must be granted to
        // the jar file containing this method.
        //
        if ( !TestConfiguration.loadingFromJars() ) { return; }

        ConnectionPoolDataSource cpDs =
                J2EEDataSource.getConnectionPoolDataSource();
       
        PooledConnection conn0 = getPooledConnection( cpDs, "user0");
        PooledConnection conn1 = getPooledConnection( cpDs, "user1");
        PooledConnection conn2 = getPooledConnection( cpDs, "user2");
View Full Code Here

            // If there is a database not found exception
            // then retry the connection request with
            // a new DataSource with the createDtabase property set.
            if (!expectedState.equals(e.getSQLState()))
                throw e;
            ConnectionPoolDataSource tmpDs =
                    singleUseDS( DataSourceConnector.makeCreateDBAttributes( config ) );
            JDBCDataSource.setBeanProperty(tmpDs, "databaseName", databaseName);
            return tmpDs.getPooledConnection().getConnection();
       }
    }
View Full Code Here

            if (!"XJ004".equals(e.getSQLState()))
                throw e;
            HashMap<String, Object> hm =
                    DataSourceConnector.makeCreateDBAttributes( config );
            DataSourceConnector.copyProperties(connectionProperties, hm);
            ConnectionPoolDataSource tmpDs = singleUseDS( hm );
            JDBCDataSource.setBeanProperty(tmpDs, "databaseName", databaseName);
            return tmpDs.getPooledConnection(user, password).getConnection();
       }
    }
View Full Code Here

        if (SanityManager.DEBUG) {
             // "false" only used with driver manager
            SanityManager.ASSERT(deregisterDriver);
        }

        ConnectionPoolDataSource tmpDs =
                singleUseDS( DataSourceConnector.makeShutdownDBAttributes( config ) );
        JDBCDataSource.setBeanProperty(tmpDs, "databaseName", "");
        tmpDs.getPooledConnection();
    }
View Full Code Here

     * from the configuration but with the passed in property set.
     */
    private ConnectionPoolDataSource singleUseDS( HashMap hm )
       throws SQLException
    {
        ConnectionPoolDataSource sds =
                J2EEDataSource.getConnectionPoolDataSource(config, hm);

        // Enable statement pooling by default for single-use data sources
        // too, just like it's enabled for the default data source in
        // setConfiguration().
View Full Code Here

         *
         * @return a <code>Connection</code> value
         * @exception SQLException if an error occurs
         */
        protected Connection newConnection_() throws SQLException {
            ConnectionPoolDataSource ds = J2EEDataSource.getConnectionPoolDataSource();
            for (Iterator it = dsProps.entrySet().iterator(); it.hasNext(); ) {
                Map.Entry e = (Map.Entry) it.next();
                J2EEDataSource.setBeanProperty(
                    ds, (String) e.getKey(), e.getValue());
            }
            PooledConnection pc =
                ds.getPooledConnection();
            return pc.getConnection();
        }
View Full Code Here

    private static void destroy( DataSource pooledDataSource, boolean force ) throws SQLException
    {
  if ( pooledDataSource instanceof PoolBackedDataSource)
      {
    ConnectionPoolDataSource cpds = ((PoolBackedDataSource) pooledDataSource).getConnectionPoolDataSource();
    if (cpds instanceof WrapperConnectionPoolDataSource)
        destroy( ((WrapperConnectionPoolDataSource) cpds).getNestedDataSource(), force );
      }
  if ( pooledDataSource instanceof PooledDataSource )
      ((PooledDataSource) pooledDataSource).close( force );
View Full Code Here

                else if (pds instanceof AbstractPoolBackedDataSource)
                {
                    String val = (String) attrObj.getValue();
                    AbstractPoolBackedDataSource apbds = ((AbstractPoolBackedDataSource) pds);
                    apbds.setFactoryClassLocation( val );
                    ConnectionPoolDataSource checkDs1 = apbds.getConnectionPoolDataSource();
                    if (checkDs1 instanceof WrapperConnectionPoolDataSource)
                    {
                        WrapperConnectionPoolDataSource wcheckDs1 = (WrapperConnectionPoolDataSource) checkDs1;
                        wcheckDs1.setFactoryClassLocation( val );
                        DataSource checkDs2 = wcheckDs1.getNestedDataSource();
View Full Code Here

    private synchronized void registerPool(
        String username, String password)
        throws javax.naming.NamingException, SQLException {

        ConnectionPoolDataSource cpds = testCPDS(username, password);

        Integer userMax = getPerUserMaxActive(username);
        int maxActive = (userMax == null) ?
            getDefaultMaxActive() : userMax.intValue();
        userMax = getPerUserMaxIdle(username);
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.