DataSource ///////////////////////////////////////////////////////////////
542393
protected void initDataSource() {
    if (dataSource == null) {
      if (dataSourceJndiName != null) {
        try {
          dataSource = (DataSource) new InitialContext().lookup(dataSourceJndiName);
        } catch (Exception e) {
          throw new ProcessEngineException("couldn't lookup datasource from " + dataSourceJndiName + ": " + e.getMessage(), e);
        }

      } else if (jdbcUrl != null) {
        if ((jdbcDriver == null) || (jdbcUrl == null) || (jdbcUsername == null)) {
          throw new ProcessEngineException("DataSource or JDBC properties have to be specified in a process engine configuration");
        }

        PooledDataSource pooledDataSource =
            new PooledDataSource(ReflectUtil.getClassLoader(), jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword);

        if (jdbcMaxActiveConnections > 0) {
          pooledDataSource.setPoolMaximumActiveConnections(jdbcMaxActiveConnections);
        }
        if (jdbcMaxIdleConnections > 0) {
          pooledDataSource.setPoolMaximumIdleConnections(jdbcMaxIdleConnections);
        }
        if (jdbcMaxCheckoutTime > 0) {
          pooledDataSource.setPoolMaximumCheckoutTime(jdbcMaxCheckoutTime);
        }
        if (jdbcMaxWaitTime > 0) {
          pooledDataSource.setPoolTimeToWait(jdbcMaxWaitTime);
        }
        if (jdbcPingEnabled == true) {
          pooledDataSource.setPoolPingEnabled(true);
          if (jdbcPingQuery != null) {
            pooledDataSource.setPoolPingQuery(jdbcPingQuery);
          }
          pooledDataSource.setPoolPingConnectionsNotUsedFor(jdbcPingConnectionNotUsedFor);
        }
        dataSource = pooledDataSource;
      }

      if (dataSource instanceof PooledDataSource) {
        // ACT-233: connection pool of Ibatis is not properely initialized if this is not called!
        ((PooledDataSource) dataSource).forceCloseAll();
      }
    }

    if (databaseType == null) {
      initDatabaseType();
    }
  }
1358750
protected function useDataSource()
    {
        $args = func_get_args();
        $dataSource = Utility::get(
            $this->params,
            "dataSource",
            Utility::get($this->params, "dataStore")
        );
        $this->dataStore = $this->standardizeDataSource($dataSource, $args);
    }
1297632
public ConnectionPoolDataSource createConnectionPoolDataSource(Properties props, String dataSourceID) throws SQLException {
        lock.readLock().lock();
        try {
            if (!isInitialized)
                try {
                    // Switch to write lock for lazy initialization
                    lock.readLock().unlock();
                    lock.writeLock().lock();

                    if (!isInitialized) {
                        if (!loadFromApp())
                            classloader = AdapterUtil.getClassLoaderWithPriv(sharedLib);
                        isInitialized = true;
                    }
                } finally {
                    // Downgrade to read lock for rest of method
                    lock.readLock().lock();
                    lock.writeLock().unlock();
                }

            String className = (String) properties.get(ConnectionPoolDataSource.class.getName());
            if (className == null) {
                String vendorPropertiesPID = props instanceof PropertyService ? ((PropertyService) props).getFactoryPID() : PropertyService.FACTORY_PID;
                className = JDBCDrivers.getConnectionPoolDataSourceClassName(vendorPropertiesPID);
                if (className == null) {
                    //if properties.oracle.ucp is configured do not search based on classname or infer because the customer has indicated
                    //they want to use UCP, but this will likely pick up the Oracle driver instead of the UCP driver (since UCP has no ConnectionPoolDataSource)
                    if("com.ibm.ws.jdbc.dataSource.properties.oracle.ucp".equals(vendorPropertiesPID)) {
                        throw new SQLNonTransientException(AdapterUtil.getNLSMessage("DSRA4015.no.ucp.connection.pool.datasource", dataSourceID, ConnectionPoolDataSource.class.getName()));
                    }
                    className = JDBCDrivers.getConnectionPoolDataSourceClassName(getClasspath(sharedLib, true));
                    if (className == null) {
                        Set<String> packagesSearched = new LinkedHashSet<String>();
                        SimpleEntry<Integer, String> dsEntry = JDBCDrivers.inferDataSourceClassFromDriver //
                                        (classloader, packagesSearched, JDBCDrivers.CONNECTION_POOL_DATA_SOURCE); 
                        className = dsEntry == null ? null : dsEntry.getValue();
                        if (className == null)
                            throw classNotFound(ConnectionPoolDataSource.class.getName(), packagesSearched, dataSourceID, null);
                    }
                }
            }

            return create(className, props, dataSourceID);
        } finally {
            lock.readLock().unlock();
        }
    }
484534
public void setDataSources(java.util.Collection<DataSource> dataSources) {
        if (dataSources == null) {
            this.dataSources = null;
            return;
        }

        this.dataSources = new com.amazonaws.internal.SdkInternalList<DataSource>(dataSources);
    }
1238811
@Override
  public final synchronized DataSource lazyGetDataSource() throws Exception {
    String beanName = getDataSourceName();
    HikariDataSource dataSource =
      (HikariDataSource) getBeansMap().get(beanName);
    if (dataSource == null) {
      dataSource = new HikariDataSource();
      dataSource.setJdbcUrl(getDatabaseName());
      dataSource.setDriverClassName("org.sqlite.JDBC");
      getBeansMap().put(beanName, dataSource);
      lazyGetLogger().info(null, FactoryAppBeansSqlite.class, beanName
        + " has been created.");
    }
    return dataSource;
  }
386245
@Override
  public final synchronized DataSource lazyGetDataSource() throws Exception {
    String beanName = getDataSourceName();
    HikariDataSource dataSource =
      (HikariDataSource) getBeansMap().get(beanName);
    if (dataSource == null) {
      Properties props = new Properties();
      props.setProperty("dataSourceClassName",
        "org.postgresql.ds.PGSimpleDataSource");
      props.setProperty("dataSource.user", getDatabaseUser());
      props.setProperty("dataSource.password", getDatabasePassword());
      props.setProperty("dataSource.databaseName", getDatabaseName());
      HikariConfig config = new HikariConfig(props);
      dataSource = new HikariDataSource(config);
      getBeansMap().put(beanName, dataSource);
      lazyGetLogger().info(null, FactoryAppBeansPostgresql.class, beanName
        + " has been created.");
    }
    return dataSource;
  }
308503
public static DataSource createDataSource(Properties poolProperties) throws SQLException {
        try {
            return MidaoFrameworkPoolBinder.createDataSource(poolProperties);
        } catch (NoClassDefFoundError ex) {
            throw new NoClassDefFoundError(ERROR_COULDNT_FIND_POOL_PROVIDER);
        }
    }
56172
private byte[] getDataSourceMetadataWithHandleAsBytes(
      final Handle handle,
      final String dataSource
  )
  {
    return connector.lookupWithHandle(
        handle,
        dbTables.getDataSourceTable(),
        "dataSource",
        "commit_metadata_payload",
        dataSource
    );
  }
867729
public static boolean registerJdbcDataSource(String name, DataSource dataSource) {
        return jdbcDataSources.putIfAbsent(name, dataSource) == null;
    }
1135501
public <T extends DataSource> T getDataSource() {
        T dataSource = jndiLookup(PropertyKey.DATA_SOURCE_JNDI_NAME);
        if (dataSource != null) {
            return dataSource;
        }
        dataSource = instantiateClass(PropertyKey.DATA_SOURCE_CLASS_NAME);
        if (dataSource == null) {
            throw new IllegalArgumentException("The " + PropertyKey.DATA_SOURCE_CLASS_NAME + " property is mandatory!");
        }
        return applyDataSourceProperties(dataSource);
    }
760183
def _init_datasource(self, data):
        
        data = self._postprocess_data(data)
        return ColumnDataSource(data=data)
801072
public static DataSource createDataSource(String source){
		String typeAndConfig = configuration.getProperty(source);
		if (typeAndConfig == null){
			log.error("No configuration for data source: " + source);
			return null;
		}
		String[] typeAndConfigArray = typeAndConfig.split(DELIMITORS, 2);
		if (typeAndConfigArray.length < 2){
			log.error("Wrong configuration format for data source '" + source + "': " + typeAndConfig);
			return null;
		}
		String type = typeAndConfigArray[0];
		String config = typeAndConfigArray[1];
		return createDataSource(source, type, config);
	}
641458
public void setDataSources(java.util.Collection<DataSource> dataSources) {
        if (dataSources == null) {
            this.dataSources = null;
            return;
        }

        this.dataSources = new java.util.ArrayList<DataSource>(dataSources);
    }
238366
public static void addToDataSource(DataSource parent, DataSource child) {
        if (!parent.getLeftDataSource().isPresent()) {
            parent.setLeftDataSource(child);
        } else if (!parent.getRightDataSource().isPresent()) {
            parent.setRightDataSource(child);
        } else {
            DataSource newLeftDataSource = new DataSource(parent.getLeftDataSource().get());
            newLeftDataSource.setRightDataSource(parent.getRightDataSource().get());
            parent.setLeftDataSource(newLeftDataSource);
            parent.setRightDataSource(child);
        }
    }
850822
public boolean setupDirectDataSourceConnection() throws DBException
    {
        if (m_JDBCConnection != null)
            return true;
        try {
            if (m_datasourceFactory == null)
            {
                String strClassName = this.getProperty(SQLParams.DATASOURCE_FACTORY);
            	strClassName = ClassServiceUtility.getFullClassName(strClassName);
                try {
                	m_datasourceFactory = (DatasourceFactory)ClassServiceUtility.getClassService().makeObjectFromClassName(strClassName);
             	    //xClass<?> c = Class.forName(strClassName);
             	    //xm_datasourceFactory = (DatasourceFactory)c.newInstance();
                } catch (Exception e) {
            		Utility.getLogger().warning("Error on create class: " + strClassName);
            		e.printStackTrace();
                }
            }
            if (m_datasourceFactory == null)
                return false;   // No factory
            ConnectionPoolDataSource poolDataSource = m_datasourceFactory.getPooledDataSource(this);
            if (poolDataSource != null)
            	if (poolDataSource.getPooledConnection() != null)
            		m_JDBCConnection = poolDataSource.getPooledConnection().getConnection();
            if (m_JDBCConnection == null)
            {   // Otherwise, just try plain datasource connection
                DataSource dataSource = m_datasourceFactory.getFakePooledDataSource(this);
                if (dataSource != null)
                    m_JDBCConnection = dataSource.getConnection();
            }
            if (m_JDBCConnection == null)
            {   // Otherwise, just try plain datasource connection
                DataSource dataSource = m_datasourceFactory.getDataSource(this);
                if (dataSource != null)
                    m_JDBCConnection = dataSource.getConnection();
                else
                    return false;   // Failure
            }
        } catch (SQLException e) {
            return false;   // Failure
        }
        return true;    // Success!
    }
1306015
public void setDatasourceParams(JdbcDatabase database, ComboPooledDataSource dataSource)
    {
        if (dataSource != null)
        {   // Try pooled connection first
	        String strURL = database.getProperty(SQLParams.JDBC_URL_PARAM);
	        if ((strURL == null) || (strURL.length() == 0))
	            strURL = database.getProperty(SQLParams.DEFAULT_JDBC_URL_PARAM);    // Default
	        String strServer = database.getProperty(SQLParams.DB_SERVER_PARAM);
	        if ((strServer == null) || (strServer.length() == 0))
	            strServer = database.getProperty(SQLParams.DEFAULT_DB_SERVER_PARAM);    // Default
	        if ((strServer == null) || (strServer.length() == 0))
	            strServer = "localhost"; //this.getProperty(DBParams.SERVER);    // ??       
	        String strDatabaseName = database.getDatabaseName(true);
	        if (strURL != null)
	        {
	            if (strServer != null)
	                strURL = Utility.replace(strURL, "{dbserver}", strServer);
	            strURL = Utility.replace(strURL, "{dbname}", strDatabaseName);
	        }
	        String strUsername = database.getProperty(SQLParams.USERNAME_PARAM);
	        if ((strUsername == null) || (strUsername.length() == 0))
	            strUsername = database.getProperty(SQLParams.DEFAULT_USERNAME_PARAM); // Default
	        String strPassword = database.getProperty(SQLParams.PASSWORD_PARAM);
	        if ((strPassword == null) || (strPassword.length() == 0))
	            strPassword = database.getProperty(SQLParams.DEFAULT_PASSWORD_PARAM); // Default
	        
	        String strDriver = database.getProperty(SQLParams.JDBC_DRIVER_PARAM);
	
	    	try {
				dataSource.setDriverClass(strDriver); //loads the jdbc driver            
			} catch (PropertyVetoException e) {
				e.printStackTrace();
			}
	//        dataSource.setDatabaseName(strDatabaseName);
	//        if (strServer != null)
	//            dataSource.setServerName(strServer);
	//        else
	            dataSource.setJdbcUrl(strURL);
	        dataSource.setUser (strUsername);
	        dataSource.setPassword (strPassword);
	        
        	// the settings below are optional -- c3p0 can work with defaults
//?        	dataSource.setMinPoolSize(5);                                     
//?        	dataSource.setAcquireIncrement(5);
//?        	dataSource.setMaxPoolSize(20);
            //xMiniConnectionPoolManager poolMgr = new MiniConnectionPoolManager(poolDataSource, MAX_POOLED_CONNECTIONS, POOL_TIMEOUT);

        }
    }
1108607
public void registerDataSource(String name, DataSource dataSource) {
        if (dataSource == null) {
            throw new NullPointerException("dataSource");
        }
        if (StringUtils.isBlank(name)) {
            throw new IllegalArgumentException("blank name");
        }
        if (name.equals("*")) {
            defaultDataSource = new DataSourceHolder(dataSource);
        } else {
            dataSources.putIfAbsent(name, new DataSourceHolder(dataSource));
        }
    }