Results 1 to 6 of 6

Thread: Error Loading MySql Driver in 4.3.4

Threaded View

Previous Post Previous Post   Next Post Next Post
  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 13:13. Reason: missing [code] tags

Similar Threads

  1. mysql driver and nmake error
    By Ghost in forum Installation and Deployment
    Replies: 13
    Last Post: 13th March 2008, 14: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, 08:11
  3. MySql plugin driver issues
    By stevey in forum Installation and Deployment
    Replies: 11
    Last Post: 20th September 2006, 13: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
  •  
Qt is a trademark of The Qt Company.