Hi,
I got a problem on connecting database on my project.
I use PyQt5.QSqlDatabase for connecting but a error occured.
from PyQt5.QtSql import *
class Database():
def __init__(self,hostname,user,dbase,pword=""):
self.db.setHostName(hostname)
self.db.setDatabaseName(dbase)
self.db.setUserName(user)
self.db.setPassword(pword)
ok = self.db.open()
mydb=Database("localhost","root","billingsys")
from PyQt5.QtSql import *
class Database():
def __init__(self,hostname,user,dbase,pword=""):
self.db=QSqlDatabase.addDatabase("QMYSQL")
self.db.setHostName(hostname)
self.db.setDatabaseName(dbase)
self.db.setUserName(user)
self.db.setPassword(pword)
ok = self.db.open()
mydb=Database("localhost","root","billingsys")
To copy to clipboard, switch view to plain text mode
Error is:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
Bookmarks