Results 1 to 6 of 6

Thread: Error: QMYSQL3 not loaded.

  1. #1
    Join Date
    Aug 2007
    Posts
    6
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Error: QMYSQL3 not loaded.

    Hi,

    I am testing small database program in QT. But while running exe I m getting error 'QMYSQL3' driver not loaded.'. But in QT Designer, using menu 'Project-Dabase connection-', connection is established. Also it is showing 'QMYSQL3' driver.
    Here is code:
    Qt Code:
    1. #include <qapplication.h>
    2. #include <qsqldatabase.h>
    3. #include <qsqlquery.h>
    4. #include "form1.h"
    5.  
    6.  
    7. int main( int argc, char ** argv )
    8. {
    9. QApplication a( argc, argv );
    10. QSqlDatabase *db=QSqlDatabase::addDatabase("QMYSQL3");
    11. db->setDatabaseName("manager");
    12. db->setUserName("root");
    13. db->setPassword("");
    14. db->setHostName("localhost");
    15. db->open();
    16. if(!db->open())
    17. {
    18. qWarning("Failed to open database.");
    19. }
    20. else
    21. {
    22. qWarning("Database opened successfully");
    23. }
    24. Form1 w;
    25. w.initValues();
    26. w.show();
    27. a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
    28. return a.exec();
    29. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jacek; 13th November 2007 at 00:46. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: QMYSQL3 not loaded.

    Quote Originally Posted by Namrata View Post
    while running exe I m getting error 'QMYSQL3' driver not loaded.'. But in QT Designer, using menu 'Project-Dabase connection-', connection is established. Also it is showing 'QMYSQL3' driver.
    Do you have only one copy of Qt installed on your system?

    Quote Originally Posted by Namrata View Post
    db->open();
    if(!db->open())
    You open the database twice.
    Last edited by jacek; 13th November 2007 at 15:09. Reason: typo

  3. #3
    Join Date
    Aug 2007
    Posts
    6
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Error: QMYSQL3 not loaded.

    Thanks for reply. I have tried by commenting that line 'db->open();'.
    But error is coming to the line,
    'QSqlDatabase *db=QSqlDatabase::addDatabase("QMYSQL3");'

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: QMYSQL3 not loaded.

    Do you have only one copy of Qt installed on your system?

  5. #5
    Join Date
    Aug 2007
    Posts
    6
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Error: QMYSQL3 not loaded.

    Actually I am new in Linux, so please tell how to check only one copy of QT is installed or not

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Error: QMYSQL3 not loaded.

    In that case you have probably only one version installed, but you can run ldd on your application and on Qt Designer and check whether paths to libqt-mt in both cases are the same.

    What does QSqlDatabase::drivers() return? Do you use qmake?

Similar Threads

  1. QSqlDatabase: QMYSQL driver not loaded
    By onder in forum Newbie
    Replies: 12
    Last Post: 29th March 2017, 14:43
  2. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  3. My Mysql 5 and Qt 4.2.2 Problem (Driver not loaded)
    By fengtian.we in forum Qt Programming
    Replies: 4
    Last Post: 9th February 2007, 08:11
  4. qodbc driver not loaded error in release mode
    By mandal in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2006, 09:42
  5. Loaded QT 4.1.1 and MinGW Compiler
    By Seth in forum Newbie
    Replies: 7
    Last Post: 8th July 2006, 15:03

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
  •  
Qt is a trademark of The Qt Company.