Package javax.sql

Examples of javax.sql.ConnectionPoolDataSource


     */
    public void initialize(Configuration configuration) throws TorqueException
    {
        super.initialize(configuration);

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


     */
    public void initialize(Configuration configuration) throws TorqueException
    {
        super.initialize(configuration);

        ConnectionPoolDataSource cpds = initCPDS(configuration);
        PerUserPoolDataSource ds = initJdbc2Pool(configuration);
        ds.setConnectionPoolDataSource(cpds);
        this.ds = ds;
    }
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

        ds.setPortNumber(Integer.parseInt(port));
      }

      bindDataSource(jndiName, ds);

      ConnectionPoolDataSource boundDs = null;

      try {
        boundDs = (ConnectionPoolDataSource) lookupDatasourceInJNDI(jndiName);

        assertTrue("Datasource not bound", boundDs != null);

        Connection dsConn = null;

        try {
          dsConn = boundDs.getPooledConnection().getConnection();
        } finally {
          if (dsConn != null) {
            dsConn.close();
          }
        }
View Full Code Here

        ds.setServerName(serverName);
      }

      bindDataSource(jndiName, ds);

      ConnectionPoolDataSource boundDs = null;

      try {
        boundDs = (ConnectionPoolDataSource) lookupDatasourceInJNDI(jndiName);

        assertTrue("Datasource not bound", boundDs != null);

        Connection dsCon = null;
        Statement dsStmt = null;

        try {
          dsCon = boundDs.getPooledConnection().getConnection();
          dsStmt = dsCon.createStatement();
          dsStmt.executeUpdate("DROP TABLE IF EXISTS testBug3920");
          dsStmt
              .executeUpdate("CREATE TABLE testBug3920 (field1 varchar(32))");
View Full Code Here

            throws SQLException {

        if (_authLevel == SQLAUTHORIZATION && isDbo() /* once is enough */) {
            final String user = "DonaldDuck";
            final String passwd = user.concat(pwSuffix);
            ConnectionPoolDataSource cpDs =
                J2EEDataSource.getConnectionPoolDataSource();
            // Test without statement pooling first.
            doTestCurrentRoleIsReset(cpDs.getPooledConnection(user, passwd),
                                     user);

            // Try to enable statement pooling.
            // This is currently only implemented in the client driver.
            if (usingDerbyNetClient()) {
                J2EEDataSource.setBeanProperty(
                    cpDs, "maxStatements",new Integer(7));
                doTestCurrentRoleIsReset(cpDs.getPooledConnection(user, passwd),
                                         user);
            }
        }
    }
View Full Code Here

        ds.setPortNumber(Integer.parseInt(port));
      }

      bindDataSource(jndiName, ds);

      ConnectionPoolDataSource boundDs = null;

      try {
        boundDs = (ConnectionPoolDataSource) lookupDatasourceInJNDI(jndiName);

        assertTrue("Datasource not bound", boundDs != null);

        Connection dsConn = null;

        try {
          dsConn = boundDs.getPooledConnection().getConnection();
        } finally {
          if (dsConn != null) {
            dsConn.close();
          }
        }
View Full Code Here

        ds.setServerName(serverName);
      }

      bindDataSource(jndiName, ds);

      ConnectionPoolDataSource boundDs = null;

      try {
        boundDs = (ConnectionPoolDataSource) lookupDatasourceInJNDI(jndiName);

        assertTrue("Datasource not bound", boundDs != null);

        Connection dsCon = null;
        Statement dsStmt = null;

        try {
          dsCon = boundDs.getPooledConnection().getConnection();
          dsStmt = dsCon.createStatement();
          dsStmt.executeUpdate("DROP TABLE IF EXISTS testBug3920");
          dsStmt
              .executeUpdate("CREATE TABLE testBug3920 (field1 varchar(32))");
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

         *
         * @return a <code>Connection</code> value
         * @exception SQLException if an error occurs
         */
        protected Connection newConnection_() throws SQLException {
            ConnectionPoolDataSource ds = J2EEDataSource.getConnectionPoolDataSource();
            PooledConnection pc =
                ds.getPooledConnection();
            return pc.getConnection();
        }
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.