Get database connections.

@param connectionMode connection mode
@param dataSourceName data source name
@param connectionSize size of connection list to be get
@return database connections
@throws SQLException SQL exception
353026
public final List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException {
        DataSource dataSource = getDataSourceMap().get(dataSourceName);
        Preconditions.checkState(null != dataSource, "Missing the data source name: '%s'", dataSourceName);
        Collection<Connection> connections;
        synchronized (cachedConnections) {
            connections = cachedConnections.get(dataSourceName);
        }
        List<Connection> result;
        if (connections.size() >= connectionSize) {
            result = new ArrayList<>(connections).subList(0, connectionSize);
        } else if (!connections.isEmpty()) {
            result = new ArrayList<>(connectionSize);
            result.addAll(connections);
            List<Connection> newConnections = createConnections(dataSourceName, connectionMode, dataSource, connectionSize - connections.size());
            result.addAll(newConnections);
            synchronized (cachedConnections) {
                cachedConnections.putAll(dataSourceName, newConnections);
            }
        } else {
            result = new ArrayList<>(createConnections(dataSourceName, connectionMode, dataSource, connectionSize));
            synchronized (cachedConnections) {
                cachedConnections.putAll(dataSourceName, result);
            }
        }
        return result;
    }
200614
public int getConnection(String connectionModel, String nodeType, int ordinal, String propertyName) {
    	int connectionModelIndex = modelHolder.getModelIndex(connectionModel);
        return getConnection(connectionModelIndex, nodeType, ordinal, propertyName);
    }
1243814
private static List<RelationID> getTableList(Connection conn, RelationListProvider relationListProvider, QuotedIDFactory idfac) throws SQLException {

		// Obtain the relational objects (i.e., tables and views)
		List<RelationID> relationIds = new LinkedList<>();
		try (Statement stmt = conn.createStatement();
				ResultSet rs = stmt.executeQuery(relationListProvider.getQuery())) {
			while (rs.next())
				relationIds.add(relationListProvider.getTableID(rs));
		}
		return relationIds;
	}
750036
protected List<String> getTableNames(final Connection connection) throws SQLException {
        ResultSet resultSet = null;

        try {
            final List<String> tables = new ArrayList<String>();

            resultSet = connection.getMetaData().getTables(null, null, "%", new String[] { "TABLE" });

            while (resultSet.next()) {
                tables.add(resultSet.getString("TABLE_NAME"));
            }
            return tables;
        } finally {
            if (resultSet != null) {
                resultSet.close();
            }
        }

    }
931265
public static DataSourceConfiguration getDataSourceConfiguration(final DataSource dataSource) {
        DataSourceConfiguration result = new DataSourceConfiguration(dataSource.getClass().getName());
        result.getProperties().putAll(findAllGetterProperties(dataSource));
        return result;
    }
792203
public Connection getConnection(String name) throws ExecutionException {
        Connection connection = null;
        synchronized (connections) {
            if (connections.containsKey(name)) {
                connection = connections.get(name);
            } else {

                String msg = "The connection [" + name + "] does not exist";
                logger.error(msg);
                throw new ExecutionException(msg);
            }
        }
        return connection;
    }
247325
public static SQLDialect getDialect(DataSource dataSource) {
		if (dataSource == null) {
			return SQLDialect.DEFAULT;
		}
		try {
			String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL");
			SQLDialect sqlDialect = JDBCUtils.dialect(url);
			if (sqlDialect != null) {
				return sqlDialect;
			}
		}
		catch (MetaDataAccessException ex) {
			logger.warn("Unable to determine jdbc url from datasource", ex);
		}
		return SQLDialect.DEFAULT;
	}
156601
public static <T> DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz)
			throws SQLException {
		DatabaseType databaseType = connectionSource.getDatabaseType();
		String tableName = DatabaseTableConfig.extractTableName(databaseType, clazz);
		List<DatabaseFieldConfig> fieldConfigs = new ArrayList<DatabaseFieldConfig>();
		for (Class<?> classWalk = clazz; classWalk != null; classWalk = classWalk.getSuperclass()) {
			for (Field field : classWalk.getDeclaredFields()) {
				DatabaseFieldConfig config = configFromField(databaseType, tableName, field);
				if (config != null && config.isPersisted()) {
					fieldConfigs.add(config);
				}
			}
		}
		if (fieldConfigs.size() == 0) {
			return null;
		} else {
			return new DatabaseTableConfig<T>(clazz, tableName, fieldConfigs);
		}
	}
967097
public List<T> queryForAll(ConnectionSource connectionSource, ObjectCache objectCache) throws SQLException {
		prepareQueryForAll();
		return query(connectionSource, preparedQueryForAll, objectCache);
	}
573280
public OrdinalSet getConnectionSet(String connectionModel, String nodeType, int ordinal, String propertyName) {
    	int connectionModelIndex = modelHolder.getModelIndex(connectionModel);
        return getConnectionSet(connectionModelIndex, nodeType, ordinal, propertyName);
    }
1102251
public static DB getConnection(String instance) {
        if(Objects.isNullOrEmpty(instance))
            instance = DEFAULT_INSTANCE;
        if(!connections.containsKey(instance)){
            initialize(instance);
        }
        return connections.get(instance);
    }
1101773
public function databaseConnection($dataSource = 'default')
    {
        try {
            $connection = ConnectionManager::get($dataSource);
            $connected = $connection->connect();
        } catch (MissingConnectionException $connectionError) {
            $connected = false;
        }
        return $connected;
    }
518544
public ConnectionResource getConnectionResource()
        throws EFapsException
    {
        try {
            if (this.connectionResource == null) {
                this.connectionResource = new ConnectionResource(Context.DATASOURCE.getConnection());
            }
        } catch (final SQLException e) {
            throw new EFapsException(getClass(), "getConnectionResource.SQLException", e);
        }
        return this.connectionResource;
    }
454668
public ConnectedCrud<T, K> to(DataSource dataSource) throws SQLException {
        Connection connection = dataSource.getConnection();
        try {
            return new ConnectedCrud<T, K>(new DataSourceTransactionTemplate(dataSource), to(connection));
        } finally {
            connection.close();
        }
    }
939207
public static SqlConfig getConfig(final String dataSourceName) {
		DataSourceConnectionSupplierImpl connectionSupplier = new DataSourceConnectionSupplierImpl(dataSourceName);
		return new DefaultSqlConfig(connectionSupplier, null);
	}
398140
private Connection getConnection() throws SQLException {
        return JDBC.connect(model.getDriver(), model.getUrl(),
                            model.getUser(), model.getPassword());

    }
531242
public DataSource createDataSourceFromConnectionInfo(final ConnectionInfo connectionInfo) throws SQLException
    {
        final PGSimpleDataSource ds = new PGSimpleDataSource();
        ds.setPortNumber(connectionInfo.getPort());
        ds.setDatabaseName(connectionInfo.getDbName());
        ds.setUser(connectionInfo.getUser());
        return ds;
    }