Returns a connection
773503
public function connection($name)
    {
        if ($name == 'default' && isset($this->_default))
            $name = $this->_default;

        if(!isset($this->_connections[$name]))
            throw new \Pheasant\Exception("No connection called $name registered");

        $connection = $this->_connections[$name];

        // lazily build the connection
        if(is_string($connection))
            $connection = $this->_connections[$name] =
                $this->_buildConnection(new Dsn($connection));

        return $connection;
    }
98558
def createConnection(self):
        """"""
        uri = self.reader.createConnection()
        return Pyro.core.getAttrProxyForURI(uri)
200506
def _get_new_connection(self, conn_params):
    """"""
    self.__connection_string = conn_params.get('connection_string', '')
    conn = self.Database.connect(**conn_params)
    return conn
1206474
def get_connection(self, *args, **kwargs):
        
        conn = super(SSLHTTPAdapter, self).get_connection(*args, **kwargs)
        if conn.assert_hostname != self.assert_hostname:
            conn.assert_hostname = self.assert_hostname
        return conn
692433
def _get_connection(self, ssl):
        """"""

        # Use SSL/TLS if requested and available.
        connect_string = self.connect_string
        if ssl and self.ssl_connect_string:
            connect_string = self.ssl_connect_string

        return pymongo.MongoClient(connect_string)
410977
def get(url, options = {})
      connection(url, options) do |uri, conn|
        conn.get(uri.request_uri, options)
      end
    end
611310
def _connection(self):
    '''
    
    '''
    try:
      return self._pool.get(False)
    except Empty:
      args = [
        self._host, self._port, self._keyspace
      ]
      kwargs = {
        'user'              : None,
        'password'          : None,
        'cql_version'       : self._cql_version,
        'compression'       : self._compression,
        'consistency_level' : self._consistency_level,
        'transport'         : self._transport,
      }
      if self._credentials:
        kwargs['user'] = self._credentials['user']
        kwargs['password'] = self._credentials['password']
      return cql.connect(*args, **kwargs)
1090396
def make_connection(self):
        ""
        if self._created_connections >= self.max_connections:
            raise ConnectionError("Too many connections")
        self._created_connections += 1
        return self.connection_class(**self.connection_kwargs)
1321151
def connect(self):
        """"""
        return self.loop.create_connection(lambda: self, self.host, self.port)
1371121
async function getConnection(url, opts = {}) {

    const dbName = opts.databaseName;
    if (!dbName || dbName === '')
        throw boom.badImplementation('jollof-data-arangodb: databaseName config is required', { url, opts })

    const key = url + dbName;

    //Get connection
    let connection;
    if (connPool[key]) {
        connection = connPool[key];
    } else {
        connection = new Database(url)
        connPool[key] = connection;
    }

    //Now ensure database exists
    const dbNames = await connection.listDatabases();
    if (dbNames.indexOf(dbName) > -1) {
        //our db exists. use it.
        connection.useDatabase(dbName)
    } else {
        //our db does not exist. Attempting to create it
        await connection.createDatabase(dbName, [{ username: opts.username, passw: opts.password }])
        connection.useDatabase(dbName)
    }

    return connection;
}
428169
def get(cls, dbname="perfdump"):
        
        try:
            return cls.connection
        except:
            cls.connect(dbname)
            return cls.connection
625521
def get_connection(hostname, username, logger, threads=5, use_sudo=None, detect_sudo=True):
    
    if username:
        hostname = "%s@%s" % (username, hostname)
    try:
        conn = remoto.Connection(
            hostname,
            logger=logger,
            threads=threads,
            detect_sudo=detect_sudo,
        )

        # Set a timeout value in seconds to disconnect and move on
        # if no data is sent back.
        conn.global_timeout = 300
        logger.debug("connected to host: %s " % hostname)
        return conn

    except Exception as error:
        msg = "connecting to host: %s " % hostname
        errors = "resulted in errors: %s %s" % (error.__class__.__name__, error)
        raise RuntimeError(msg + errors)
1021791
def __get_connection(self) -> redis.Redis:
        

        if self.__redis_use_socket:
            r = redis.from_url(
                'unix://{:s}?db={:d}'.format(
                    self.__redis_host,
                    self.__redis_db
                )
            )
        else:
            r = redis.from_url(
                'redis://{:s}:{:d}/{:d}'.format(
                    self.__redis_host,
                    self.__redis_port,
                    self.__redis_db
                )
            )

        if BlackRed.Settings.REDIS_AUTH is not None:
            r.execute_command('AUTH {:s}'.format(BlackRed.Settings.REDIS_AUTH))
        return r
1042858
def make_connection(self):
        """"""
        if self._created_connections[self._pattern_idx] >= self.max_connections_per_pattern:
            raise ConnectionError("Too many connections")
        self._created_connections[self._pattern_idx] += 1
        conn = self.connection_class(**self.patterns[self._pattern_idx])
        conn._pattern_idx = self._pattern_idx
        return conn
1334642
def receive_connection():
    
    server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    server.bind(("localhost", 8080))
    server.listen(1)
    client = server.accept()[0]
    server.close()
    return client
994220
def get_connection_by_name(self, name):
        ''''''
        with self._mutex:
            for conn in self.connections:
                if conn.name == name:
                    return conn
            return None
1200621
async function getConnection(url, opts = {}) {
    try {
        const dbName = opts.databaseName;
        if (!dbName || dbName === '')
            throw boom.badImplementation('jollof-data-arangodb: databaseName config is required', { url, opts })

        const key = url + dbName;

        //Get connection
        let connection;
        if (connPool[key]) {
            connection = connPool[key];
        } else {
            connection = new Database(opts)
            connection.useBasicAuth(opts.username, opts.password)
            connPool[key] = connection;
        }

        //Now ensure database exists
        const dbNames = await connection.listDatabases();
        if (dbNames.indexOf(dbName) > -1) {
            //our db exists. use it.
            connection.useDatabase(dbName)
        } else {
            //our db does not exist. Attempting to create it
            await connection.createDatabase(dbName)
            connection.useDatabase(dbName)
        }

        return connection;
    } catch (e) {
        console.error(`There was an issue creating/ensuring connection to DB: ${url} with opts: ${util.inspect(opts)}`)
        throw new Error(e);
    }
}