Open Doradus database, setting m_client.
332901
private void openDatabase() {
        m_client = new Client(m_config.host, m_config.port, m_config.getTLSParams());
        m_client.setCredentials(m_config.getCredentials());
    }
1090529
def _mk_client():
    '''
    
    '''
    if 'cp.fileclient_{0}'.format(id(__opts__)) not in __context__:
        __context__['cp.fileclient_{0}'.format(id(__opts__))] = \
                salt.fileclient.get_file_client(__opts__)
615996
public void open() throws DBException
    {
        if (m_JDBCConnection == null)
        {
            String strJdbcDriver = this.getProperty(SQLParams.JDBC_DRIVER_PARAM);
            if ((strJdbcDriver == null) || (strJdbcDriver.length() == 0))
            { // If a JDBC driver isn't specified, set up for the default driver
                String strDataSource = this.getProperty(SQLParams.DATASOURCE_PARAM);
                if (strDataSource == null)
                    strDataSource = this.getProperty(SQLParams.DEFAULT_DATASOURCE_PARAM);
                if (strDataSource == null)
                    strDataSource = SQLParams.DEFAULT_DATASOURCE;
                boolean bDataSourceConnection = false;
                if (strDataSource != null)
                    bDataSourceConnection = this.setupDataSourceConnection(strDataSource);

                String strDatabaseProductName = null;
                try {
					if (m_JDBCConnection != null)
					{
						strDatabaseProductName = m_JDBCConnection.getMetaData().getDatabaseProductName();
						strDatabaseProductName = this.fixDatabaseProductName(strDatabaseProductName);
					}
				} catch (SQLException e) {
					e.printStackTrace();
				}
                if ((strDatabaseProductName == null) || (strDatabaseProductName.length() == 0))
                	strDatabaseProductName = this.getProperty(SQLParams.DATABASE_PRODUCT_PARAM);
                if ((strDatabaseProductName == null) || (strDatabaseProductName.length() == 0))
                    strDatabaseProductName = DEFAULT_DATABASE_PRODUCT;
                this.setProperty(SQLParams.INTERNAL_DB_NAME, strDatabaseProductName);
                this.setupDatabaseProperties(); // If I haven't read the db properties, read them now!

                if (!bDataSourceConnection)
                {	// Datasource connection could be supplied in the db properties
                    String strDBDataSource = this.getProperty(SQLParams.DATASOURCE_PARAM);
                    if (strDBDataSource == null)
                    	strDBDataSource = this.getProperty(SQLParams.DEFAULT_DATASOURCE_PARAM);
                    if (strDBDataSource != null)
                    	if (!strDBDataSource.equalsIgnoreCase(strDataSource))
                        	bDataSourceConnection = this.setupDataSourceConnection(strDBDataSource);                	
                }
                if (!bDataSourceConnection)
                    bDataSourceConnection = this.setupDirectDataSourceConnection();
                if (!bDataSourceConnection)
                {
                    strJdbcDriver = this.getProperty(SQLParams.JDBC_DRIVER_PARAM);  // Default driver
                    if (strJdbcDriver == null)
                        strJdbcDriver = this.getProperty(BASE_DATABASE_JDBC_DRIVER);    // Special case - base database
                }
            }
            if (strJdbcDriver != null)
                this.setupJDBCConnection(strJdbcDriver);
            this.initConnection();
            this.loadDatabaseProperties();
        }
        
        super.open(); // Do any inherited
    }
1270420
def setup_db(session, botconfig, confdir):
    """"""
    Base.metadata.create_all(session.connection())
    # If we're creating a fresh db, we don't need to worry about migrations.
    if not session.get_bind().has_table('alembic_version'):
        conf_obj = config.Config()
        conf_obj.set_main_option('bot_config_path', confdir)
        with resources.path('cslbot', botconfig['alembic']['script_location']) as script_location:
            conf_obj.set_main_option('script_location', str(script_location))
            command.stamp(conf_obj, 'head')

    # Populate permissions table with owner.
    owner_nick = botconfig['auth']['owner']
    if not session.query(Permissions).filter(Permissions.nick == owner_nick).count():
        session.add(Permissions(nick=owner_nick, role='owner'))
710592
public void doOpen() throws DBException
    {
        super.doOpen();
        try   {
            m_pTable.open(this);
        } catch (DBException ex)    {
            throw DatabaseException.toDatabaseException(ex);
        }
    }
1238591
def open(self):
        """"""
        # guess protocol
        if self.protocol==0:
            _in = open(self.name) # don't specify binary mode !
        else:
            _in = open(self.name,'rb')
        self.fields = cPickle.load(_in)
        self.next_id = cPickle.load(_in)
        self.records = cPickle.load(_in)
        self.indices = cPickle.load(_in)
        for f in self.indices.keys():
            setattr(self,'_'+f,Index(self,f))
        _in.close()
        self.mode = "open"
        return self
415945
def database(key='default', slave=False):
    
    if slave:
        key += '.slave'
        return choice(__db[key])
    return __db.get(key)
767144
def master_open():
    """"""

    try:
        master_fd, slave_fd = os.openpty()
    except (AttributeError, OSError):
        pass
    else:
        slave_name = os.ttyname(slave_fd)
        os.close(slave_fd)
        return master_fd, slave_name

    return _open_terminal()
678580
def open_database(parameters):
    """"""
    spanner_client = spanner.Client()
    instance_id = parameters['cloudspanner.instance']
    instance = spanner_client.instance(instance_id)
    database_id = parameters['cloudspanner.database']
    pool = spanner.BurstyPool(int(parameters['num_worker']))
    database = instance.database(database_id, pool=pool)

    return database
602294
def set_mysql_connection(host='localhost', user='pyctd_user', password='pyctd_passwd', db='pyctd', charset='utf8'):
    """"""
    set_connection('mysql+pymysql://{user}:{passwd}@{host}/{db}?charset={charset}'.format(
        host=host,
        user=user,
        passwd=password,
        db=db,
        charset=charset)
    )
608939
protected function openConnection()
    {
        // set standard values
        $this->configuration = array_merge([
            'host' => 'localhost',
            'database' => '',
            'username' => '',
            'password' => '',
            'table-prefix' => 'saft_',
        ], $this->configuration);

        /*
         * check for missing connection credentials
         */
        if ('' == $this->configuration['database']) {
            throw new \Exception('ARC2: Field database is not set.');
        } elseif ('' == $this->configuration['username']) {
            throw new \Exception('ARC2: Field username is not set.');
        } elseif ('' == $this->configuration['host']) {
            throw new \Exception('ARC2: Field host is not set.');
        }

        // init store
        $this->store = \ARC2::getStore([
            'db_host' => $this->configuration['host'],
            'db_name' => $this->configuration['database'],
            'db_user' => $this->configuration['username'],
            'db_pwd' => $this->configuration['password'],
            'store_name' => $this->configuration['table-prefix'],
        ]);
    }
1134581
public void open() throws DBException
    {
        if (this.isOpen())
            return;         // Ignore if already open
        m_bIsOpen = false;
        this.getRecord().handleInitialKey();        // Set up the smaller key
        this.getRecord().handleEndKey();            // Set up the larger key
        this.doOpen();      // Now do the physical open in sub class.
        m_bIsOpen = true;
        m_iRecordStatus = DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF;
        if ((this.getRecord().getOpenMode() & DBConstants.OPEN_SUPPRESS_MESSAGES) == 0)
            this.getRecord().handleRecordChange(DBConstants.AFTER_REQUERY_TYPE);    // Notify listeners that a new table will be built
    }
525142
private void setDatabaseClient(DatabaseClient databaseClient) {
        this.databaseClient = databaseClient;
        this.sparqlManager = getDatabaseClient().newSPARQLQueryManager();
        this.graphManager = getDatabaseClient().newGraphManager();
    }
544494
def cli(conf):
    
    try:
        config = init_config(conf)
        debug = config.getboolean('DEFAULT', 'debug')
        conn = get_conn(config.get('DEFAULT','statusdb'))
        cur = conn.cursor()
        sqlstr = '''create table client_status
        (session_id text PRIMARY KEY, username text, userip text, 
            realip text, realport int,ctime int,
            inbytes int, outbytes int, 
            acct_interval int, session_timeout int, uptime int)
        '''
        try:
            cur.execute('drop table client_status')
        except:
            pass
        cur.execute(sqlstr)
        print 'flush client status database'
        conn.commit()
        conn.close()
    except:
        traceback.print_exc()
1283477
def _open(self):
        
        try:
            self.db = connect(
                host=self.settings.host,
                port=self.settings.port,
                user=coalesce(self.settings.username, self.settings.user),
                passwd=coalesce(self.settings.password, self.settings.passwd),
                db=coalesce(self.settings.schema, self.settings.db),
                read_timeout=coalesce(self.settings.read_timeout, (EXECUTE_TIMEOUT / 1000) - 10 if EXECUTE_TIMEOUT else None, 5*60),
                charset=u"utf8",
                use_unicode=True,
                ssl=coalesce(self.settings.ssl, None),
                cursorclass=cursors.SSCursor
            )
        except Exception as e:
            if self.settings.host.find("://") == -1:
                Log.error(
                    u"Failure to connect to {{host}}:{{port}}",
                    host=self.settings.host,
                    port=self.settings.port,
                    cause=e
                )
            else:
                Log.error(u"Failure to connect.  PROTOCOL PREFIX IS PROBABLY BAD", e)
        self.cursor = None
        self.partial_rollback = False
        self.transaction_level = 0
        self.backlog = []  # accumulate the write commands so they are sent at once
        if self.readonly:
            self.begin()
151049
def create_welcome_client(self):
        """"""
        if self.tabwidget.count() == 0:
            welcome = open(WELCOME).read()
            client = NotebookClient(self, WELCOME, ini_message=welcome)
            self.add_tab(client)
            return client
966881
def open(self, new=False):
        '''
        
        '''
        self._db.new() if new else self._db.open()  # pylint: disable=W0106
        self._run_init_queries()