Answer the question
In order to leave comments, you need to log in
Why does QSqlDatabase.open() always return True?
I read from the documentation that QSqlDatabase.open() Opens a database connection and returns True on success and False on failure.
But in practice, "at least piss in the eyes - all God's dew."
Regardless of the connection result, I get True.
from PyQt5.QtSql import
db = QSqlDatabase.addDatabase("QMYSQL")
db.setHostName("acidalia")
db.setDatabaseName("customdb")
db.setUserName("mojito")
db.setPassword("J0a1m8")
ok = db.open()
print(db.open()) #почему всегда True???
db.close()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question