Creates a new physical connection to the database
		
		@author: Nick Verbeck
		@since: 5/12/2008
773130
def Connect(self):
		
		if self.connection is None:
			self.connection = MySQLdb.connect(*[], **self.connectionInfo.info)
			
		if self.connectionInfo.commitOnEnd is True:
			self.connection.autocommit()
			
		self._updateCheckTime()
834068
def connect(self, *, db=None):
        
        if db:
            self.poll(command="stop")
            self.properties.db_name = db.split(".")[0]
            self.new_state(DeviceFromDB)
        else:
            self._log.warning(
                "Already connected, provide db arg if you want to connect to db"
            )
1211224
protected static function initConnection()
    {
        $readConfig = new DBConfig();
        self::$conn_list = $readConfig->getAllConnection();
        self::$conn_list['db'] = $readConfig->getDefaultConnection();
        self::$conn_name_list = array_keys(self::$conn_list);
    }
266989
async def create_connection(self):
        ''''''
        connector = self.proxy or self.loop
        return await connector.create_connection(
            self.session_factory, self.host, self.port, **self.kwargs)
266029
function createConnection() {

  // create the internal socket object
  var server = new Socket()
    , client = new Socket();

  // pair the sockets
  client.pair = server;
  server.pair = client;

  // register the server side so it is wrapped
  // in a connection and stored as an active connection
  this.connection(server);

  // return the client side of the socket
  return client;
}
538401
def new_connection
      Connection.new(Backburner.configuration.beanstalk_url) { |conn| Backburner::Hooks.invoke_hook_events(self, :on_reconnect, conn) }
    end
455779
private function connect()
    {
        try {
            $this->db = new \PDO(
                $this->dbOptions['dsn'],
                $this->dbOptions['username'],
                $this->dbOptions['password'],
                $this->dbOptions['driver_options']
            );

        } catch (\Exception $e) {
            //Change to true to debug database connection
            if ($this->dbOptions['debug']) {
                // For debug purpose, shows all connection details
                throw $e;
            } else {
                // Hide connection details.
                throw new \PDOException("Could not connect to database, hiding connection details.");
            }
        }
        $this->db->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_OBJ);
    }
1023745
final public function openConnection ()
	{
		$this->connection = mysqli_connect(
			getConstant('DB_HOST', TRUE),
			getConstant('DB_USERNAME', TRUE),
			getConstant('DB_PASSWORD', TRUE),
			getConstant('DB_NAME', TRUE)
		);
		$errorMessage 	= "Database connection failed: ".mysqli_connect_error();
		$errorMessage 	.= " (" .mysqli_connect_errno(). ")";
		if (!$this->connection) die($errorMessage);
	}
301922
public function createConnection()
    {
        $uri                = $this->pool->getConnectionAddress();
        $options            = $this->parseUri($uri);
        $options['timeout'] = $this->pool->getTimeout();

        /** @var DbPoolProperties $config */
        $config     = $this->pool->getPoolConfig();
        $strictType = $config->isStrictType();
        $fetchMode  = $config->isFetchMode();

        $serverConfig = [
            'host'        => $options['host'],
            'port'        => $options['port'],
            'user'        => $options['user'],
            'password'    => $options['password'],
            'database'    => $options['database'],
            'timeout'     => $options['timeout'],
            'charset'     => $options['charset'],
            'strict_type' => $strictType,
        ];

        if (version_compare(swoole_version(), '4.0', '>=')) {
            $serverConfig['fetch_mode'] = $fetchMode;
        }

        // init
        $mysql = new MySQL();
        $mysql->connect($serverConfig);

        // error
        if ($mysql->connected === false) {
            throw new MysqlException('Database connection error，error=' . $mysql->connect_error);
        }

        $this->originDb   = $options['database'];
        $this->connection = $mysql;
    }
1360678
private function connectToDb()
    {
        if (!$this->dbConn = @mysql_connect($this->host, $this->dbUser, $this->dbPass)) {
            $this->handleError();
        } else if (!@mysql_select_db($this->dbName, $this->dbConn)) {
            $this->handleError();
        }
    }
81502
def _create_connection(self):
        
        db = psycopg2.connect(database=self.dbname,
                                user=self.user, password=self.password,
                                host=self.host, port=self.port)
        if 'psycopg2.extras' in sys.modules:
            psycopg2.extras.register_hstore(db)
        return db
1323180
public function connection()
    {
        if (!is_object($this->db)) {
            $this->db = new DB;
            $this->db->addConnection($this->database);
            $this->db->setEventDispatcher(new Dispatcher(new Container));
            $this->db->setAsGlobal();
            $this->db->bootEloquent();
        }

        return $this;
    }
1077581
public function connect()
    {
        if (!$this->isConnected()) {
            $this->pdo = $this->createPDO();
            $this->pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [Statement::class]);
        }
    }
1020591
public function create()
    {
        $conn = $this->connection->getConnection();
        $db = r\db($this->connection->getDatabaseName());
        $db->tableCreate($this->table)->run($conn);
    }
695777
public function createTable(): void
    {
        // connect if we are not yet
        $conn = $this->getConnection();
        $driver = $this->getDriver();

        if ($conn instanceof Connection) {
            $schema = new Schema();
            $table = $schema->createTable($this->table);
            $table->addColumn($this->idCol, 'string', ['length' => 64]);
            $table->addColumn($this->tokenCol, 'string', ['length' => 44]);
            $table->addColumn($this->expirationCol, 'integer', ['unsigned' => true]);
            $table->setPrimaryKey([$this->idCol]);

            foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
                $conn->exec($sql);
            }

            return;
        }

        switch ($driver) {
            case 'mysql':
                $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(64) NOT NULL PRIMARY KEY, $this->tokenCol VARCHAR(44) NOT NULL, $this->expirationCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB";
                break;
            case 'sqlite':
                $sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->tokenCol TEXT NOT NULL, $this->expirationCol INTEGER)";
                break;
            case 'pgsql':
                $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(64) NOT NULL PRIMARY KEY, $this->tokenCol VARCHAR(64) NOT NULL, $this->expirationCol INTEGER)";
                break;
            case 'oci':
                $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR2(64) NOT NULL PRIMARY KEY, $this->tokenCol VARCHAR2(64) NOT NULL, $this->expirationCol INTEGER)";
                break;
            case 'sqlsrv':
                $sql = "CREATE TABLE $this->table ($this->idCol VARCHAR(64) NOT NULL PRIMARY KEY, $this->tokenCol VARCHAR(64) NOT NULL, $this->expirationCol INTEGER)";
                break;
            default:
                throw new \DomainException(sprintf('Creating the lock table is currently not implemented for PDO driver "%s".', $driver));
        }

        $conn->exec($sql);
    }
371302
protected function connect()
    {
        if ($this->databaseHandle !== null) {
            return;
        }
        try {
            $splitdsn = explode(':', $this->dataSourceName, 2);
            $this->pdoDriver = $splitdsn[0];

            if ($this->pdoDriver === 'sqlite' && !file_exists($splitdsn[1])) {
                if (!file_exists(dirname($splitdsn[1]))) {
                    Files::createDirectoryRecursively(dirname($splitdsn[1]));
                }
                $this->databaseHandle = new \PDO($this->dataSourceName, $this->username, $this->password);
                $this->createCacheTables();
            } else {
                $this->databaseHandle = new \PDO($this->dataSourceName, $this->username, $this->password);
            }
            $this->databaseHandle->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

            if ($this->pdoDriver === 'mysql') {
                $this->databaseHandle->exec('SET SESSION sql_mode=\'ANSI\';');
            }
        } catch (\PDOException $exception) {
            throw new Exception('Could not connect to cache table with DSN "' . $this->dataSourceName . '". PDO error: ' . $exception->getMessage(), 1334736164);
        }
    }
243769
private function create()
    {
        // Generate session ID
        $this->sessionId = $this->generateId();

        // Insert new session into database
        $stmt = $this->db->prepare("INSERT INTO {$this->tableName} (session_id, user_agent, ip_address, time_updated) VALUES (?, ?, ?, ?)");
        $stmt->execute([$this->sessionId, $this->userAgent, $this->ipAddress, $this->now]);
    }