Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Using PythonXY and PyQt
Forum Update on Monday, May 27th 2025

Using PythonXY and PyQt

Scheduled Pinned Locked Moved Language Bindings
2 Posts 2 Posters 5.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SlyFly
    wrote on 6 Jul 2011, 01:03 last edited by
    #1

    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:

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bb6xt
      wrote on 1 Sept 2011, 20:44 last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved