Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. PySide + Sqlite = Driver not loaded

PySide + Sqlite = Driver not loaded

Scheduled Pinned Locked Moved 3rd Party Software
3 Posts 2 Posters 4.5k 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.
  • N Offline
    N Offline
    NitrousUK
    wrote on last edited by
    #1

    Despite a great deal of Googling, I can't find why Qt is unable to find the Sqlite plugin for a QSqlDatabase.
    Things I have verified:
    libqt-sql-sqlite package installed
    /usr/lib/x86_64-linux-gnu/qt4/plugins/sqldrivers/libsqlite.so is present
    "/usr/lib/x86_64-linux-gnu/qt4/plugins/" is present in the QApplication libraryPaths()
    Tried instantiating QApplication prior to call to addDatabase so that library search paths are initialised.

    When I call drivers() on the QSqlDatabase, it listed QSQLITE as an available driver. But when I call addDatabase("QSQLITE"), the database is not open/valid with a lastError of "Driver not loaded Driver not loaded". I've got Qt/PySide installed from Ubuntu packages, so I can't (as far as I know) do the configure option to force Sql driver building/static-linking.
    Any pointers are greatly appreciated.

    OS: Ubuntu 11.10 x64
    Current latest packages of Qt/PySide.

    I can't help thinking this must be a bug, by the fact QSqlDatabase tells me the driver is available, with the drivers() list as well as even explicitly stating "isDriverAvailable("QSQLITE")" -> True, but then failing to add a database with this driver as the driver/plugin isn't loaded.

    1 Reply Last reply
    0
    • N Offline
      N Offline
      NitrousUK
      wrote on last edited by
      #2

      Ok, found the problem. User error as usual. I failed to notice that the addDatabase function was a static and not a bound method. I was deriving from QSqlDatabase and calling it on self, my bad. Though I'm a little perplexed as to why the lastError function returned "Driver not loaded"..that threw me off a bit. Calling the static addDatabase shouldn't have changed the state of my derived object, so I don't know where that "driver not loaded" error came from, as the object was for all intent blank/uninitialised.
      Unless driver not loaded is the default error message for when an Sql object is uninitialised?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        welcome to devnet

        Good to know that your problem has been solved even so the community was in your case not of much help ;-)

        Special thanks also for sharing the reasons of your problem. This allows at least others to learn from your case.

        Vote the answer(s) that helped you to solve your issue(s)

        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