Results 1 to 1 of 1

Thread: How to connect MySQL with QT

  1. #1
    Join Date
    May 2009
    Posts
    28
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to connect MySQL with QT

    Hi all.
    I want to use QT and connect to mysql server.
    I have a big problem and i really can not fix that.

    Step :

    I install Free QT SDK

    I make a simple project.

    in .pro file

    QT += sql

    Source file :

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    2. db.setHostName("127.0.0.1");
    3. db.setDatabaseName("ytr");
    4. db.setUserName("root");
    5. db.setPassword("");
    6. if (!db.open()) {
    7. QMessageBox::critical(0, QObject::tr("Database Error"),
    8. db.lastError().text());
    To copy to clipboard, switch view to plain text mode 

    After i run my project :

    It appears me a message " QMYSQL driver can not loaded"
    I try again with QMYSQL3, QMYSQL4... It show the same.

    What problem with me ?

    Thanks.
    Diego
    Last edited by wysota; 27th May 2009 at 10:14. Reason: missing [code] tags

Similar Threads

  1. QT 4.5 QMYSQL and Mysql 4.1 servers does not work
    By elektritter in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2009, 15:53
  2. Application only 'animates' once
    By arkain in forum Qt Programming
    Replies: 7
    Last Post: 29th April 2009, 08:09
  3. VS2005+Qt4.2.2:Get a Mysql connect error.HELP!!
    By fengtian.we in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2007, 12:23
  4. MySQL starting problem
    By shamik in forum General Discussion
    Replies: 5
    Last Post: 25th April 2007, 07: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.