Results 1 to 6 of 6

Thread: Error Loading MySql Driver in 4.3.4

  1. #1
    Join Date
    Mar 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Unhappy Error Loading MySql Driver in 4.3.4

    Hello,
    I've modified one of the Sql connector examples included with the Qt installation to connect to a mysql database. I'm using the eval version with MSVS 2005. The code compiles but when I try to call createConnection() I get a "Driver Not Loaded" error. The main thing I don't understand is that this worked under 4.3.3 but breaks now, even though 4.3.4 is completely backwards compatible. Here's the code. Thanks in advance.

    Qt Code:
    1. #ifndef MYSQL_CONNECTION_H
    2. #define MYSQL_CONNECTION_H
    3.  
    4. #include <QMessageBox>
    5. #include <QSqlDatabase>
    6. #include <QSqlError>
    7. #include <QSqlQuery>
    8. #include <QString>
    9. #include <QStringList>
    10. static bool createConnection()
    11. {
    12. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    13. db.setDatabaseName("scheduling");
    14. db.setHostName("127.0.0.1");
    15. db.setUserName("root");
    16. db.setPassword("dora");
    17. if (!db.open()) {
    18. QMessageBox::critical(0, "Cannot open database",
    19. "Unable to establish a database connection. " + db.lastError().text() + ".\n\n\n"
    20. "Click Cancel to exit.", QMessageBox::Cancel);
    21. return false;
    22. }
    23. return true;
    24. }
    25. #endif
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 26th March 2008 at 14:13. Reason: missing [code] tags

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Error Loading MySql Driver in 4.3.4

    Quote Originally Posted by perrigo View Post
    Hello,
    I've modified one of the Sql connector examples included with the Qt installation to connect to a mysql database. I'm using the eval version with MSVS 2005. The code compiles but when I try to call createConnection() I get a "Driver Not Loaded" error. The main thing I don't understand is that this worked under 4.3.3 but breaks now, even though 4.3.4 is completely backwards compatible. Here's the code. Thanks in advance.
    #endif
    if you run demo application
    Qt/4.3.3_src/demos/sqlbrowser/release
    you can see all loaded Driver if see QMYSQL driver can work otherwise have a look on wiki to install...

  3. #3
    Join Date
    Mar 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Error Loading MySql Driver in 4.3.4

    QMYSQL isn't among the options in the "Driver" combo box. Only QSQLITE, QODBC, and QPSQL are available.

  4. #4
    Join Date
    Feb 2008
    Posts
    79
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Error Loading MySql Driver in 4.3.4

    I have exactly the same problem.

  5. #5
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Error Loading MySql Driver in 4.3.4

    Quote Originally Posted by Tiansen View Post
    I have exactly the same problem.
    i try 4 week a go on Microsoft Visual Studio 2008 beta the qt build -qt-sql-mysql run and work.. but now i use a MingW compiler qt build ( less dll )

    grab mingw compiler from ftp://ftp.trolltech.com/qt/source/qt...eta1-mingw.exe
    and build ftp://ftp.trolltech.com/qt/source/qt...-src-4.3.0.zip -qt-sql-mysql
    like http://wiki.qtcentre.org/index.php?t...ws_using_MinGW

  6. #6
    Join Date
    Mar 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Error Loading MySql Driver in 4.3.4

    You see, I would rather solve my problem than avoid it. I'm using VS 2005 and would like for the code to work. The exact same code ran correctly in 4.3.3. If anyone has gotten the MySql driver to load please include a bit of sample code. Thanks.

Similar Threads

  1. mysql driver and nmake error
    By Ghost in forum Installation and Deployment
    Replies: 13
    Last Post: 13th March 2008, 15:23
  2. 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, 09:11
  3. MySql plugin driver issues
    By stevey in forum Installation and Deployment
    Replies: 11
    Last Post: 20th September 2006, 14:45

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.