Package javax.sql

Examples of javax.sql.ConnectionPoolDataSource


    // test jira-derby 95 - a NullPointerException was returned when passing
    // an incorrect database name, should now give error XCY00  
    // with ConnectionPoolDataSource
    public void testJira95pds() throws Exception {
        try {
            ConnectionPoolDataSource pds = J2EEDataSource.getConnectionPoolDataSource();
            JDBCDataSource.setBeanProperty(pds, "databaseName", "jdbc:derby:boo");
            pds.getPooledConnection();
            fail ("expected an SQLException!");
        } catch (SQLException sqle) {
            assertSQLState("XCY00", sqle);
        } catch (Exception e) {
            throw e;
View Full Code Here


   
    // there is a corresponding fixture for datasources in DataSourceTest
    public void testBadConnectionAttributeSyntax() throws SQLException {
       
        // ConnectionPoolDataSource - bad connatr syntax
        ConnectionPoolDataSource cpds = J2EEDataSource.getConnectionPoolDataSource();
        JDBCDataSource.setBeanProperty(cpds, "ConnectionAttributes", "bad");
        try {
            cpds.getPooledConnection();
            fail ("should have seen an error");
        } catch (SQLException e) {
            assertSQLState("XJ028", e);
        }
View Full Code Here

        JDBCDataSource.clearStringBeanProperty(ds, "password");
        ds = null;

        // now with ConnectionPoolDataSource
        String cpdsName = dsclient.getConnectionPoolDataSourceClassName();
        ConnectionPoolDataSource cpds =
              (ConnectionPoolDataSource) Class.forName(cpdsName).newInstance();

        // ConnectionPoolDataSource - EMPTY
        dsConnectionRequests(new String[] { 
            "XJ004","XJ004","XJ004","XJ004",
View Full Code Here

            return;

        String traceFile;

        // with ConnectionPoolDataSource
        ConnectionPoolDataSource cpds = J2EEDataSource.getConnectionPoolDataSource();

        traceFile = "trace3.out";
        JDBCDataSource.setBeanProperty(cpds, "connectionAttributes",
            "traceFile="+traceFile);
        // DERBY-2468 - trace3.out does not get created
View Full Code Here

     *
     * @throws SQLException if something goes wrong
     */
    public void testConnectionLeakInDatabaseMetaData()
            throws SQLException {
        ConnectionPoolDataSource cpDs =
                J2EEDataSource.getConnectionPoolDataSource();
        PooledConnection pc = cpDs.getPooledConnection();
        // Get first logical connection and a meta data object.
        Connection con1 = pc.getConnection();
        DatabaseMetaData dmd1 = con1.getMetaData();
        assertSame(con1, dmd1.getConnection());
        con1.close();
View Full Code Here

     * connection. The problem was that the LOB stored procedure objects on the
     * server side were closed and not reprepared.
     * See Jira issue DERBY-3799.
     */
    public void testDerby3799() throws SQLException {
        ConnectionPoolDataSource cpDs =
                J2EEDataSource.getConnectionPoolDataSource();
        PooledConnection pc = cpDs.getPooledConnection();
        // Get first logical connection.
        Connection con1 = pc.getConnection();
        Statement stmt = con1.createStatement();
        ResultSet rs = stmt.executeQuery("select dClob from derby3799");
        assertTrue(rs.next());
View Full Code Here

    public void timeoutTestDerby1144PooledDS() throws SQLException {
   
        PooledConnection pc1 = null;

        // Test holdability  
        ConnectionPoolDataSource ds =
            J2EEDataSource.getConnectionPoolDataSource();
        pc1 = ds.getPooledConnection();
        assertPooledConnHoldability("PooledConnection", pc1);
        pc1.close();
       
        // Test autocommit
        pc1 = ds.getPooledConnection();
        assertPooledConnAutoCommit("PooledConnection", pc1);
        pc1.close();
       
        // Test pooled connection isolation
        pc1 = ds.getPooledConnection();
        assertPooledConnIso("PooledConnection" , pc1);  
        pc1.close();
    }
View Full Code Here

     */
    public void configure( Configuration conf ) throws ConfigurationException
    {
        Configuration poolController = conf.getChild( "pool-controller" );
        String dbname = conf.getChild( "dbname" ).getValue( "ifx" );
        ConnectionPoolDataSource pooledDataSource = (ConnectionPoolDataSource) getInstance( "com.informix.jdbcx.IfxConnectionPoolDataSource" );
        m_autocommit = conf.getChild( "autocommit" ).getValueAsBoolean( true );

        setProperty(pooledDataSource, "IfxCPMInitPoolSize", new Integer(poolController.getAttributeAsInteger( "init", 5 ) ) );
        setProperty(pooledDataSource, "IfxCPMMinPoolSize", new Integer(poolController.getAttributeAsInteger( "min", 5 ) ) );
        setProperty(pooledDataSource, "IfxCPMMaxPoolSize", new Integer(poolController.getAttributeAsInteger( "max", 10 ) ) );
View Full Code Here

        throws java.sql.SQLException
    {
        try
        {
            Class c = Class.forName("oracle.jdbc.pool.OracleConnectionPoolDataSource");
            ConnectionPoolDataSource instance =
                            (ConnectionPoolDataSource) c.newInstance();

            // use introspection to set the url in order to avoid import
            // of JDBC specific classes
            Method m = c.getMethod("setURL", new Class[]{ String.class });
View Full Code Here

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

        ConnectionPoolDataSource cpds = testCPDS(username, password);

        // Create an object pool to contain our PooledConnections
        GenericKeyedObjectPool tmpPool = new GenericKeyedObjectPool(null);
        tmpPool.setMaxActive(getMaxActive());
        tmpPool.setMaxIdle(getMaxIdle());
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.