Results 1 to 2 of 2

Thread: db driver not loaded

  1. #1
    Join Date
    Jan 2011
    Posts
    32
    Thanks
    11
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: db driver not loaded

    Hi,

    I have to separate test projects with almost the same code. PostgreSQL driver is loaded in one of them only. Could You help me?

    It is loaded here:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtSql>
    3. #include <QMessageBox>
    4.  
    5. #include "dialog.h"
    6.  
    7.  
    8. int main(int argc, char *argv[])
    9. {
    10. QApplication a(argc, argv);
    11.  
    12. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL7");
    13. qDebug() << "DRIVERS :" << QSqlDatabase::drivers();
    14.  
    15. DB_test_Dialog w;
    16. w.show();
    17.  
    18. return a.exec();
    19. }
    To copy to clipboard, switch view to plain text mode 
    with this drivers
    DRIVERS : ("QSQLITE", "QODBC3", "QODBC", "QPSQL7", "QPSQL")


    and not loaded here:
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtSql>
    3. #include <QMessageBox>
    4.  
    5. #include "widget.h"
    6.  
    7. int main(int argc, char *argv[])
    8. {
    9. QApplication a(argc, argv);
    10.  
    11. QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
    12. qDebug() << "DRIVERS :" << QSqlDatabase::drivers();
    13.  
    14. Widget w;
    15. w.show();
    16.  
    17. return a.exec();
    18. }
    To copy to clipboard, switch view to plain text mode 
    with this message:
    QSqlDatabase: QPSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL
    DRIVERS : ("QSQLITE", "QMYSQL3", "QMYSQL")


    I use the same enviroment.


    Added after 57 minutes:


    OK. It is a path issue. Once I add
    Qt Code:
    1. a.addLibraryPath("path");
    To copy to clipboard, switch view to plain text mode 
    I get all drivers and no error message issued.
    I am using QT creator for building. Where can I set these paths? Why one of the test projects works correctly?
    Last edited by mak_user; 3rd March 2011 at 05:29.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: db driver not loaded

    Where is the QPSQL7 plugin located on your disk?

Similar Threads

  1. 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, 16:00
  2. Replies: 1
    Last Post: 24th April 2010, 04:43
  3. Driver not loaded
    By wirasto in forum Qt Programming
    Replies: 0
    Last Post: 23rd November 2009, 07:08
  4. Driver not loaded
    By rogerio in forum Installation and Deployment
    Replies: 8
    Last Post: 16th May 2009, 08:07
  5. Help,driver not loaded!
    By vencent in forum Qt Programming
    Replies: 2
    Last Post: 26th December 2007, 02:20

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.