Package javax.sql

Examples of javax.sql.PooledConnection.addConnectionEventListener()


    } else {
      pc = dataSource.getPooledConnection();
    }
    Connection conn = pc.getConnection();
    activeConnections.incrementAndGet();
    pc.addConnectionEventListener(this);
    return conn;
  }

  /**
   * This method usually puts the connection back into the pool. There are some
View Full Code Here


        }
        else
        {
            pc = cpds.getPooledConnection(username, password);
        }
        pc.addConnectionEventListener(this);

        // Age some connections so that there will not be a run on the db,
        // when connections start expiring
        //
        // I did some experimentation here with integers but as this
View Full Code Here

        throws SQLException {
        PooledConnection connection =
            (userName != null)
                ? poolDataSource.getPooledConnection(userName, password)
                : poolDataSource.getPooledConnection();
        connection.addConnectionEventListener(this);
        return connection;
    }

    /** Closes all existing connections, removes them from the pool. */
    public void dispose() throws SQLException {
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug("Created " + connection
                         + " for " + physicalConnection);
        }

        connection.addConnectionEventListener(listener);

        return connection;
    }

    private void discardPooledConnection(PooledConnection connection) {
View Full Code Here

        } else {
            pc = dataSource.getPooledConnection();
        }
        Connection conn = pc.getConnection();
        activeConnections++;
        pc.addConnectionEventListener(this);
        return conn;
    }

    /**
     * This method usually puts the connection back into the pool. There are
View Full Code Here

            ds = new ClientConnectionPoolDataSource();
            ((ClientConnectionPoolDataSource)ds).setDatabaseName(dbName);
        }
        pc = ds.getPooledConnection();
        //Add a connection event listener to ConnectionPoolDataSource
        pc.addConnectionEventListener(aes12);
        conn = pc.getConnection();
        st = conn.createStatement();
        //TAB1 does not exist and hence catch the expected exception
        try {
            st.executeUpdate("drop table TAB1");
View Full Code Here

        {
            SecurityCheck.assertSourceSecurity(
                pc, "javax.sql.PooledConnection");
        }
        AssertEventCatcher aes1 = new AssertEventCatcher(1);
        pc.addConnectionEventListener(aes1);

        // DERBY-2531
        // with Network Server / DerbyNetClient, the assertConnectionOK check
        // returns a different connection object...
        assertConnectionOK(
View Full Code Here

        assertFalse(aes3.didConnectionErrorEventHappen());
        aes3.resetState();
                      
        pc = dsp.getPooledConnection();
        AssertEventCatcher aes2 = new AssertEventCatcher(2);
        pc.addConnectionEventListener(aes2);
        assertConnectionOK(
            expectedValues, "ConnectionPoolDataSource", pc.getConnection());
        //Check if got connection closed event but not connection error event
        assertTrue(aes2.didConnectionClosedEventHappen());
        assertFalse(aes2.didConnectionErrorEventHappen());
View Full Code Here

    protected PooledConnection newPooledConnection(String userName, String password)
            throws SQLException {
        PooledConnection connection = (userName != null) ? poolDataSource
                .getPooledConnection(userName, password) : poolDataSource
                .getPooledConnection();
        connection.addConnectionEventListener(this);
        return connection;
    }

    /**
     * Closes all existing connections, removes them from the pool.
View Full Code Here

            logger.warning("StatementPooling not " +
                     "implemented for external (non-c3p0) " +
                     "ConnectionPoolDataSources.");
              }
            }
        out.addConnectionEventListener( cl );
        return out;
          }
      catch (Exception e)
          {
        if (logger.isLoggable( MLevel.WARNING ))
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.