Package javax.sql

Examples of javax.sql.PooledConnection.addConnectionEventListener()


    final int NB_TESTS = 5;

    try {
      pc = this.cpds.getPooledConnection();

      pc.addConnectionEventListener(conListener);

      for (int i = 0; i < NB_TESTS; i++) {
        Connection pConn = pc.getConnection();

        System.out.println("Before connection.close().");
View Full Code Here


       
        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");

        //No event should have been generated at this point
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

            } else {
                pc = _cpds.getPooledConnection(_username, _password);
            }
            // should we add this object as a listener or the pool.
            // consider the validateObject method in decision
            pc.addConnectionEventListener(this);
            obj = new PooledConnectionAndInfo(pc, _username, _password);
            pcMap.put(pc, obj);
        } catch (SQLException e) {
            throw new RuntimeException(e.getMessage());
        }
View Full Code Here

        } else {
            pc = _cpds.getPooledConnection(username, password);
        }
        // should we add this object as a listener or the pool.
        // consider the validateObject method in decision
        pc.addConnectionEventListener(this);
        obj = new PooledConnectionAndInfo(pc, username, password);
        pcMap.put(pc, obj);
        return obj;
    }
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. */
    public void dispose() throws SQLException {
View Full Code Here

        //Get the correct ConnectionPoolDataSource object
        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");

        //No event should have been generated at this point
View Full Code Here

                        {
                            //invalidate the proxy Connection
                            ConnectionUtils.attemptClose( con );
                        }
                       
                        out.addConnectionEventListener( cl );
                        return out;
                    }
                    catch (Exception e)
                    {
                        if (logger.isLoggable( MLevel.WARNING ))
View Full Code Here

                        finally
                        {
                            // close the proxy Connection
                            ConnectionUtils.attemptClose(con);
                           
                            pc.addConnectionEventListener( cl );
                        }
                    }
                   
                    if ( testConnectionOnCheckin )
                    {
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.