code: def open(self, writeAccess=False):
          
          host = self.database().writeHost() if writeAccess else self.database().host()
          pool = self.__pool[host]
  
          if self.__poolSize[host] >= self.__maxSize or pool.qsize():
              if pool.qsize() == 0:
                  log.warning('Waiting for connection to database!!!')
              return pool.get()
          else:
              db = self.database()
  
              # process a pre-connect event
              event = orb.events.ConnectionEvent()
              db.onPreConnect(event)
  
              self.__poolSize[host] += 1
              try:
                  conn = self._open(self.database(), writeAccess=writeAccess)
              except Exception:
                  self.__poolSize[host] -= 1
                  raise
              else:
                  event = orb.events.ConnectionEvent(success=conn is not None, native=conn)
                  db.onPostConnect(event)
                  return conn
docs: Returns the sqlite database for the current thread.
  
          :return     <variant> || None