def openDB(self): self.log.info("WSGI Server Opening DB...") self.log.info("DB Path = %s", self.dbPath) # Local sockets are MUCH faster if the DB is on the same machine as the server # Try a local connection. fall back to IP socket only if local connection fails. try: self.conn = psycopg2.connect(dbname=settings.DATABASE_DB_NAME, user=settings.DATABASE_USER,password=settings.DATABASE_PASS) except psycopg2.OperationalError: self.conn = psycopg2.connect(host=settings.DATABASE_IP, dbname=settings.DATABASE_DB_NAME, user=settings.DATABASE_USER,password=settings.DATABASE_PASS) sm.checkStatusTableExists()
def openDB(self): self.log.info("WSGI Server Opening DB...") self.log.info("DB Path = %s", self.dbPath) self.conn = sqlite3.connect(self.dbPath, check_same_thread=False) self.log.info("DB opened. Activating 'wal' mode") rets = self.conn.execute('''PRAGMA journal_mode=wal;''') rets = self.conn.execute('''PRAGMA locking_mode=EXCLUSIVE;''') rets = rets.fetchall() self.log.info("PRAGMA return value = %s", rets) sm.checkStatusTableExists()
def openDB(self): self.log.info("WSGI Server Opening DB...") self.log.info("DB Path = %s", self.dbPath) # Local sockets are MUCH faster if the DB is on the same machine as the server # Try a local connection. fall back to IP socket only if local connection fails. try: self.conn = psycopg2.connect(dbname=settings.DATABASE_DB_NAME, user=settings.DATABASE_USER, password=settings.DATABASE_PASS) except psycopg2.OperationalError: self.conn = psycopg2.connect(host=settings.DATABASE_IP, dbname=settings.DATABASE_DB_NAME, user=settings.DATABASE_USER, password=settings.DATABASE_PASS) sm.checkStatusTableExists()