Results 1 to 4 of 4

Thread: Sqllite driver not loaded in qt 5.0.0

  1. #1
    Join Date
    Feb 2013
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Sqllite driver not loaded in qt 5.0.0

    My sqllite driver is found but it is not loading .
    I searched alot in my many websites but unfortunately no outcome.
    I am using windows7 , sqlite3 database and qt 5.0... what I already did ..

    - Add qt+= sql in .pro file
    - copy sqlite.dll & sqllited.dll libraries in project folder.

    It is throwing error while opening the database.Following are the error lines.

    " QSqlite driver found.
    QSqlite library loaded.
    FATAL: Database failed to initialize!
    Driver not loaded Driver not loaded
    QSqlQuery::exec: database not open
    failed"

    PLease help me to solve this issue .... Below is my code snippet.

    Qt Code:
    1. if (isDriverAvailable("QSQLITE")){
    2. qDebug("QSqlite driver found.");
    3.  
    4. QLibrary sqlib("E:\\PROJECTS\\QT Project\\TaskAssistant\\TaskAssistant-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug\\sqldrivers\\qsqlite.dll");
    5. if (sqlib.load())
    6. qDebug("QSqlite library loaded.");
    7. else
    8. qDebug(sqlib.errorString().toStdString().c_str());
    9.  
    10.  
    11. addDatabase("QSQLITE");
    12. setDatabaseName("E:\\PROJECTS\\QT Project\\TaskAssistant\\TaskAssistant\\db\\timeassistantdb");
    13. //finally testing the connection
    14. if (open()){
    15. close(); //database finally opened. no need to do any thing else
    16. qDebug("Database successfully connected.");
    17. return;
    18. }
    19. else{
    20. qCritical("FATAL: Database failed to initialize!");
    21. QSqlError error = lastError();
    22. qCritical( error.text().toStdString().c_str() );
    23. }
    24. }
    25. else{
    26. qCritical("FATAL: SQLITE driver doesn't exist!");
    27. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    May 2008
    Location
    Tripoli Libya
    Posts
    70
    Thanks
    10
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Sqllite driver not loaded in qt 5.0.0

    Qt Code:
    1. QLibrary sqlib("E:\\PROJECTS\\QT Project\\TaskAssistant\\TaskAssistant-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug\\sqldrivers\\qsqlite.dll");
    To copy to clipboard, switch view to plain text mode 
    why !!! ==>go to your executable dir ==>generate dir plugins\sqldrivers place qsqlite.dll(or qsqlited.dll if your build is debug ) ==>plugins\sqldrivers
    Qt Code:
    1. toStdString().c_str()
    To copy to clipboard, switch view to plain text mode 
    !!!!!! check your code
    http://www.developer.nokia.com/Commu...database_in_Qt
    Last edited by alrawab; 21st February 2013 at 00:07.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Sqllite driver not loaded in qt 5.0.0

    In a deployed application the Sql driver plugins should be in "%APPDIR%/sqldrivers", i.e. no "plugins/" directory.

    As alrawab points out, you do not need to do anything to explicitly locate or load the driver DLL.

  4. #4
    Join Date
    May 2008
    Location
    Tripoli Libya
    Posts
    70
    Thanks
    10
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Sqllite driver not loaded in qt 5.0.0

    sorry i meant "move the driver from QTDIR/plugins/sqldrivers to app sqldrivers "
    my focus was focused on unnecessary conversions " qDebug(sqlib.errorString().toStdString().c_str());"
    and "QLibrary sqlib("E:\\PROJECTS\\QT Project\\TaskAssistant\\TaskAssistant-build-Desktop_Qt_5_0_0_MSVC2010_32bit_SDK-Debug\\sqldrivers\\qsqlite.dl"

Similar Threads

  1. driver not loaded!
    By hala in forum Qt Programming
    Replies: 1
    Last Post: 15th June 2012, 00:53
  2. App found qsqlite4.dll driver file but still "Driver not loaded"
    By merelendor in forum Installation and Deployment
    Replies: 2
    Last Post: 17th August 2011, 11:15
  3. Help with QMYSQL driver for QT 4.4.0: driver not loaded
    By khikho in forum Installation and Deployment
    Replies: 4
    Last Post: 1st April 2011, 15:00
  4. Replies: 1
    Last Post: 24th April 2010, 03:43
  5. Help,driver not loaded!
    By vencent in forum Qt Programming
    Replies: 2
    Last Post: 26th December 2007, 01:20

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.