Add a new {@link JdbcConnectionDescriptor}.
352060
public void addDescriptor(JdbcConnectionDescriptor jcd)
    {
        synchronized (jcdMap)
        {
            if (jcdMap.containsKey(jcd.getPBKey()))
            {
                throw new MetadataException("Found duplicate connection descriptor using PBKey " +
                        jcd.getPBKey() + ", remove the old descriptor first, before add the new one. " + jcd);
            }
            jcdMap.put(jcd.getPBKey(), jcd);
            // only if the jcdAlias was not found, put the new PBKey,
            // because we don't want to replace the original PBKey with
            // automatic generated descriptors PBKey's - see method getDescriptor(PBKey key)
            if (!jcdAliasToPBKeyMap.containsKey(jcd.getJcdAlias()))
            {
                jcdAliasToPBKeyMap.put(jcd.getJcdAlias(), jcd.getPBKey());
            }
            if (log.isDebugEnabled()) log.debug("New descriptor was added: " + jcd);
        }
    }
1162005
public void discoverConnnectionProperties() {
    Connection connection = null;
    try {
      connection = getConnection();
      if (connection == null) {
        getLogger().warn("Could not get a conneciton");
        return;
      }
      DatabaseMetaData meta = connection.getMetaData();
      Util util = new Util();
      util.setLoggerRepository(repository);
      if (overriddenSupportsGetGeneratedKeys != null) {
        supportsGetGeneratedKeys = overriddenSupportsGetGeneratedKeys
            .booleanValue();
      } else {
        supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
      }
      supportsBatchUpdates = util.supportsBatchUpdates(meta);
      dialectCode = Util.discoverSQLDialect(meta);
    } catch (SQLException se) {
      getLogger().warn("Could not discover the dialect to use.", se);
    } finally {
      DBHelper.closeConnection(connection);
    }
  }
230344
public CouchDbConnector createConnector() {
        val connector = new StdCouchDbConnector(couchDbProperties.getDbName(), getCouchDbInstance(), objectMapperFactory);
        LOGGER.debug("Connector created: [{}]", connector);

        return connector;
    }
65689
private <T> void add(EjbDescriptor<T> ejbDescriptor) {
        InternalEjbDescriptor<T> internalEjbDescriptor = InternalEjbDescriptor.of(ejbDescriptor);
        ejbByName.put(ejbDescriptor.getEjbName(), internalEjbDescriptor);
        ejbByClass.put(ejbDescriptor.getBeanClass(), internalEjbDescriptor.getEjbName());
    }
1321284
@Override
    public void addConnectionListener(SICoreConnectionListener listener)
                    throws SIConnectionDroppedException,
                    SIConnectionUnavailableException {

        checkValid();

        _delegateConnection.addConnectionListener(listener);

    }
562857
public static Connection newInstance(Connection conn) {
        return (Connection) java.lang.reflect.Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[]{Connection.class},
                new ConnectionProxy(conn));
        /*
        return (Connection) java.lang.reflect.Proxy.newProxyInstance(conn.getClass().getClassLoader(), conn.getClass().getInterfaces(),
                new ConnectionProxy(conn));
                */
    }
487414
private void buildNewInstanceMethodForBuilder( MethodSpec.Builder newInstanceMethodBuilder ) {
        newInstanceMethodBuilder.addStatement( "return new $T(builderDeserializer.deserializeInline(reader, ctx, params, null, null, null, bufferedProperties).build(), bufferedProperties)",
                parameterizedName( Instance.class, beanInfo.getType() ) );
    }
307064
private void addConnection() throws SQLException {

    //create new connection
    Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo);
    MariaDbConnection connection = new MariaDbConnection(protocol);
    MariaDbPooledConnection pooledConnection = createPoolConnection(connection);

    if (options.staticGlobal) {
      //on first connection load initial state
      if (globalInfo == null) {
        initializePoolGlobalState(connection);
      }
      //set default transaction isolation level to permit resetting to initial state
      connection.setDefaultTransactionIsolation(globalInfo.getDefaultTransactionIsolation());
    } else {
      //set default transaction isolation level to permit resetting to initial state
      connection.setDefaultTransactionIsolation(connection.getTransactionIsolation());
    }

    if (poolState.get() == POOL_STATE_OK
        && totalConnection.incrementAndGet() <= options.maxPoolSize) {
      idleConnections.addFirst(pooledConnection);

      if (logger.isDebugEnabled()) {
        logger.debug("pool {} new physical connection created (total:{}, active:{}, pending:{})",
            poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get());
      }
      return;
    }

    silentCloseConnection(pooledConnection);
  }
685550
@Override
  public void initializeConnection() throws SQLException {
    super.initializeConnection();
    this.currentProtocol = null;
    //launching initial loop
    reconnectFailedConnection(new SearchFilter(true, false));
    resetMasterFailoverData();
  }
319665
public static SqlInfoBuilder newInstace(BuildSource source) {
        SqlInfoBuilder builder = new SqlInfoBuilder();
        builder.init(source);
        return builder;
    }
1272770
@Override
    public ConnectionFactory createConnectionFactory(JmsJcaConnectionFactory jcaConnectionFactory) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createConnectionFactory", jcaConnectionFactory);
        ConnectionFactory cf = new JmsManagedConnectionFactoryImpl(jcaConnectionFactory);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createConnectionFactory", cf);
        return cf;
    }
921480
@Override
	public void addConnectorCustomizers(
			TomcatConnectorCustomizer... tomcatConnectorCustomizers) {
		Assert.notNull(tomcatConnectorCustomizers,
				"TomcatConnectorCustomizers must not be null");
		this.tomcatConnectorCustomizers.addAll(Arrays.asList(tomcatConnectorCustomizers));
	}
1314142
protected ObjectPool setupPool(JdbcConnectionDescriptor jcd)
    {
        log.info("Create new ObjectPool for DBCP connections:" + jcd);

        try
        {
            ClassHelper.newInstance(jcd.getDriver());
        }
        catch (InstantiationException e)
        {
            log.fatal("Unable to instantiate the driver class: " + jcd.getDriver() + " in ConnectionFactoryDBCImpl!" , e);
        }
        catch (IllegalAccessException e)
        {
            log.fatal("IllegalAccessException while instantiating the driver class: " + jcd.getDriver() + " in ConnectionFactoryDBCImpl!" , e);
        }
        catch (ClassNotFoundException e)
        {
            log.fatal("Could not find the driver class : " + jcd.getDriver() + " in ConnectionFactoryDBCImpl!" , e);
        }

        // Get the configuration for the connection pool
        GenericObjectPool.Config conf = jcd.getConnectionPoolDescriptor().getObjectPoolConfig();

        // Get the additional abandoned configuration
        AbandonedConfig ac = jcd.getConnectionPoolDescriptor().getAbandonedConfig();

        // Create the ObjectPool that serves as the actual pool of connections.
        final ObjectPool connectionPool = createConnectionPool(conf, ac);

        // Create a DriverManager-based ConnectionFactory that
        // the connectionPool will use to create Connection instances
        final org.apache.commons.dbcp.ConnectionFactory connectionFactory;
        connectionFactory = createConnectionFactory(jcd);

        // Create PreparedStatement object pool (if any)
        KeyedObjectPoolFactory statementPoolFactory = createStatementPoolFactory(jcd);

        // Set validation query and auto-commit mode
        final String validationQuery;
        final boolean defaultAutoCommit;
        final boolean defaultReadOnly = false;
        validationQuery = jcd.getConnectionPoolDescriptor().getValidationQuery();
        defaultAutoCommit = (jcd.getUseAutoCommit() != JdbcConnectionDescriptor.AUTO_COMMIT_SET_FALSE);

        //
        // Now we'll create the PoolableConnectionFactory, which wraps
        // the "real" Connections created by the ConnectionFactory with
        // the classes that implement the pooling functionality.
        //
        final PoolableConnectionFactory poolableConnectionFactory;
        poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,
                connectionPool,
                statementPoolFactory,
                validationQuery,
                defaultReadOnly,
                defaultAutoCommit,
                ac);
        return poolableConnectionFactory.getPool();
    }
601356
@Override
    public void addConnectionEventListener( ConnectionEventListener listener ) {
        if (listener == null) {
            throw new IllegalArgumentException("Listener is null");
        }
        listeners.add(listener);
    }
435423
@Override
    public ConnectionFactory createConnectionFactory(JmsJcaConnectionFactory jcaConnectionFactory, JmsJcaManagedConnectionFactory jcaManagedConnectionFactory) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createConnectionFactory", new Object[] { jcaConnectionFactory, jcaManagedConnectionFactory });
        ConnectionFactory cf = new JmsConnectionFactoryImpl(jcaConnectionFactory, jcaManagedConnectionFactory);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createConnectionFactory", cf);
        return cf;
    }
1180248
private void pushJDBCSupport(CodeBuilder b) {
        b.loadThis();
        b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, TypeDesc.forClass(TriggerSupport.class));
        b.checkCast(TypeDesc.forClass(JDBCSupport.class));
    }
584315
protected void openConnection() throws SQLException {
        if (connection == null) {
            try {
                Class.forName(configuration.getJdbcDriver());
            } catch (NullPointerException npe) {
                throw new RuntimeException("error while lookup jdbc driver class. jdbc driver is not configured.", npe);
            } catch (ClassNotFoundException e) {
                throw new RuntimeException("jdbc driver not found", e);
            }

            connection = DriverManager.getConnection(configuration.getJdbcUrl(), configuration.getJdbcUser(),
                    configuration.getJdbcPassword());
            connection.setAutoCommit(false);
        }
    }