So, its like these, I made a cluster database for PostgreSQL, with the help of this answer starting postgresql and pgadmin in windows without installation. So the Database is working I can see on PgAdmin, but when I tried to connect it through PyQt5 I got these error:
Driver not loaded Driver not loaded
I tried QPSQL driver and QPSQL7 driver but still the same error so I went to see all available drivers i got:
QSQLITE, QMYSQL, QMYSQL3, QODBC, QODBC3, QPSQL, QPSQL7
when I tried to read the driver error I got:
Driver not loaded
and when I tried to read the database error I got:
Driver not loaded
But when I try to Use psycopg2 lib it works, perfectly. So that got me thinking maybe I installed my PyQt5 wrongly, but I used pip to install all libs. Does anyone know why is it happening and can anyone help me?
def creatConn():
_db = QSqlDatabase.addDatabase('QPSQL')
_db.setDatabaseName('database')
_db.setUserName('username')
_db.setPassword('password')
_db.setPort(int('port')
_db.setHostName('host')
if _db.open():
return _db
else:
return False