Using PythonXY and PyQt



  • Complete newbie to creating drivers. Trying to connect PyQt to Mysql.
    Need a newbie level guide.

    In PythonXY, there are is
    C:\Python26\Lib\site-packages\PyQt4\plugins\sqldrivers\

    which has qsqlmysql4.dll
    qsqlodbc.dll

    it just does not work

    code:
    @
    from PyQt4 import QtSql
    import sys
    from PyQt4.QtCore import *
    from PyQt4.QtGui import *
    from PyQt4.QtSql import *
    import PyQt4

    app = QApplication(sys.argv)
    w = QTextBrowser()

    DB type, host, user, password...

    db = QSqlDatabase.addDatabase("qsqlmysql4");
    db.setHostName("localhost")
    db.setDatabaseName("test")
    db.setUserName("root")
    db.setPassword("")
    ok = db.open()@

    error:
    QSqlDatabase: QsqlMYSQL4 driver not loaded
    QSqlDatabase: available drivers:



  • use
    db = QSqlDatabase.addDatabase("QMYSQL")
    at line 12.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.