Results 1 to 2 of 2

Thread: SQLite driver available but don't load- QSqlDatabase

  1. #1
    Join Date
    Jul 2018
    Posts
    1
    Qt products
    Platforms
    Unix/X11

    Default SQLite driver available but don't load- QSqlDatabase

    Hi,

    I'm coding in PyQt5 ( version 5.9.2 ) in Ubuntu (using anaconda/spyder environment) and I'm trying to access a database by QSqlDatabase but
    Qt Code:
    1. import sys
    2. import sqlite3
    3. from PyQt5.QtWidgets import QApplication, QWidget, QTableView, QHBoxLayout
    4. from PyQt5.QtSql import QSqlDatabase
    5.  
    6.  
    7. if __name__ == "__main__" :
    8. app = QApplication(sys.argv)
    9. t = QWidget()
    10. print(list(map(str, QSqlDatabase.drivers())))
    11. dbname = "test.db"
    12. db = QSqlDatabase()
    13. db.addDatabase("QSQLITE")
    14. db.setDatabaseName("test.db")
    15. if(db.open()):
    16. print("Opened!")
    17. db.close()
    18. else:
    19. print(db.lastError().databaseText())
    20. print(list(map(str, db.drivers())))
    21.  
    22.  
    23.  
    24. t.show()
    25. sys.exit(app.exec_())
    To copy to clipboard, switch view to plain text mode 
    gives me
    Driver not loaded
    ['QSQLITE']

    When I run ldd libqsqlite.r in the folder sqldrivers inside the folder where I have installed PyQt5 it gives me :
    linux-vdso.so.1 => (0x00007fffe93f5000)
    libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007efe41c7b000)
    libQt5Sql.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007efe4210a000)
    libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007efe417a5000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007efe41423000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efe41059000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efe40e3c000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efe40c38000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007efe40a1e000)
    libicui18n.so.55 => /usr/lib/x86_64-linux-gnu/libicui18n.so.55 (0x00007efe405bc000)
    libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007efe40228000)
    libpcre16.so.3 => /usr/lib/x86_64-linux-gnu/libpcre16.so.3 (0x00007efe3ffc2000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007efe3fcb1000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007efe3faa9000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efe3f7a0000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007efe3f58a000)
    /lib64/ld-linux-x86-64.so.2 (0x00007efe41f50000)
    libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007efe3dad3000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007efe3d863000)

    I have Qt version 5.9.5.

    I really don't know what happen and I looked for an answer for 2 days but I can't manage to fix it, if anybody could help me it be great !

  2. #2
    Join Date
    Jul 2018
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: SQLite driver available but don't load- QSqlDatabase

    Same Problem i have also faced in Qt-4.7.4.After that i have compiled my application with that driver.Then it worked perfectly.
    Once try this way, i think it will help full for you

Similar Threads

  1. QSqlDatabase : no driver available
    By Jef in forum Newbie
    Replies: 3
    Last Post: 13th September 2017, 11:57
  2. QSqlDataBase + Driver not loaded
    By Adraesh in forum Qt Programming
    Replies: 17
    Last Post: 24th November 2012, 17:15
  3. Sqlite & QSqlDatabase problem
    By rsimone in forum Newbie
    Replies: 5
    Last Post: 29th July 2009, 22:52
  4. SQLite - QSqlDatabase::transaction()
    By whitefurrows in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2009, 17:06
  5. Cannot load SQLITE driver on clean target
    By ForestDweller in forum Installation and Deployment
    Replies: 1
    Last Post: 15th December 2008, 01:49

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.