Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PySide2.QtSql, How to load the available driver?
Forum Update on Tuesday, May 27th 2025

PySide2.QtSql, How to load the available driver?

Scheduled Pinned Locked Moved Solved Qt for Python
3 Posts 2 Posters 789 Views 1 Watching
  • 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.
  • Volodymyr14V Offline
    Volodymyr14V Offline
    Volodymyr14
    wrote on last edited by
    #1

    Available drivers:
    [u'QSQLITE', u'QMYSQL', u'QMYSQL3', u'QODBC', u'QODBC3', u'QPSQL', u'QPSQL7']
    When :

        sql_db = QtSql.QSqlDatabase()
        sql_db.addDatabase('QSQLITE')
    

    Error:
    PySide2.QtSql.QSqlError("", "Driver not loaded", "Driver not loaded")

    PyQt/PySide

    1 Reply Last reply
    0
    • - Offline
      - Offline
      -KRS-
      wrote on last edited by
      #2

      I think you need to do it as you're creating the QSqlDatabase object.
      Try doing this instead.

      sql_db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
      
      Volodymyr14V 1 Reply Last reply
      0
      • - -KRS-

        I think you need to do it as you're creating the QSqlDatabase object.
        Try doing this instead.

        sql_db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
        
        Volodymyr14V Offline
        Volodymyr14V Offline
        Volodymyr14
        wrote on last edited by
        #3

        @-KRS- Thank You, Solved! Didn`t use QtSql before. :)

        PyQt/PySide

        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