Page 1 of 2 12 LastLast
Results 1 to 20 of 29

Thread: QMYSQL database driver installation files

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default QMYSQL database driver installation files

    I want to use QMYSQL.
    What are the driver installation files I need to install to work with my Qt4.6.2
    and where can i get it?
    Which version of QMYSQL I need to use ?
    What are the procedures?

  2. #2
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL database driver installation files

    Read this guide.

  3. The following user says thank you to saa7_go for this useful post:

    babygal (27th July 2010)

  4. #3
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3.  
    4. QApplication app(argc, argv);
    5.  
    6. qDebug() << QSqlDatabase::drivers();
    7. if (!createConnection())
    8. return 1;
    9.  
    10. Q_INIT_RESOURCE(cardiacprocessingtoolkit);
    11. MainWindow mainWin;
    12. mainWin.show();
    13.  
    14.  
    15. return app.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 
    The debug message reads as:
    ("QSQLITE", "QMYSQL3", "QMYSQL", "QODBC3", "QODBC")

    but the connection fails ! what's wrong?

  5. #4
    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: QMYSQL database driver installation files

    Quote Originally Posted by babygal View Post
    but the connection fails ! what's wrong?
    Show us how you connect to your database and look at the error message.

  6. #5
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by Lykurg View Post
    Show us how you connect to your database and look at the error message.

    Qt Code:
    1. static bool createConnection()
    2. {
    3. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    4. db.setHostName("localhost");
    5. db.setDatabaseName("DatabaseName");
    6. if (!db.open()) {
    7. QMessageBox::critical(0, qApp->tr("Cannot open database"),
    8. qApp->tr("Unable to establish a database connection.\n"
    9. "This example needs MYSQL support. Please read "
    10. "the Qt SQL driver documentation for information how "
    11. "to build it.\n\n"
    12. "Click Cancel to exit."), QMessageBox::Cancel);
    13. return false;
    14. }
    15.  
    16.  
    17.  
    18.  
    19.  
    20. return true;
    21. }
    To copy to clipboard, switch view to plain text mode 

  7. #6
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL database driver installation files

    Can you connect to your MySQL server using MySQL client (mysql.exe) without username and password? Make sure your database "DatabaseName" exist and MySQL service is running.

  8. #7
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by saa7_go View Post
    Can you connect to your MySQL server using MySQL client (mysql.exe) without username and password? Make sure your database "DatabaseName" exist and MySQL service is running.

    No I am not able to connect.I've no idea what's wrong.

  9. #8
    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: QMYSQL database driver installation files

    Then probably you have to start your server!

  10. #9
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL database driver installation files

    In your previous post,
    Quote Originally Posted by babygal View Post
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3.  
    4. QApplication app(argc, argv);
    5.  
    6. qDebug() << QSqlDatabase::drivers();
    7. if (!createConnection())
    8. return 1;
    9.  
    10. Q_INIT_RESOURCE(cardiacprocessingtoolkit);
    11. MainWindow mainWin;
    12. mainWin.show();
    13.  
    14.  
    15. return app.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 
    The debug message reads as:
    ("QSQLITE", "QMYSQL3", "QMYSQL", "QODBC3", "QODBC")
    Why do you look for libmysql.lib? You already have mysql plugin.

  11. #10
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by saa7_go View Post
    In your previous post,


    Why do you look for libmysql.lib? You already have mysql plugin.



    So what does that mean? I don't need the installation files?

    confused.....
    Last edited by babygal; 11th August 2010 at 08:26.

  12. #11
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by babygal View Post
    So what does that mean? I don't need the installation files?
    confused.....
    You don't need to rebuild QMYSQL plugin again, but you need MySQL server. Just, create(or use) a database, a table, inserting some record. Then, try to connect to mysql server using Qt, and see what happen(success or error).

  13. The following user says thank you to saa7_go for this useful post:

    babygal (12th August 2010)

  14. #12
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by saa7_go View Post
    You don't need to rebuild QMYSQL plugin again, but you need MySQL server. Just, create(or use) a database, a table, inserting some record. Then, try to connect to mysql server using Qt, and see what happen(success or error).
    Do I need to do some configuration in my *.pro file to enable the MySql?

  15. #13
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by babygal View Post
    Do I need to do some configuration in my *.pro file to enable the MySql?
    No, but you must add sql module in your .pro.

    Qt Code:
    1. QT += sql
    To copy to clipboard, switch view to plain text mode 

  16. The following user says thank you to saa7_go for this useful post:

    babygal (12th August 2010)

  17. #14
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by saa7_go View Post
    No, but you must add sql module in your .pro.

    Qt Code:
    1. QT += sql
    To copy to clipboard, switch view to plain text mode 
    Thank you. I have added this line : QT += sql in my *.pro

    The server is configured on another PC and my PC is supposedly the client. Does it make a difference in my code/project?

  18. #15
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by babygal View Post
    Does it make a difference in my code/project?
    No. But, don't forget to set the correct hostname/ip where mysql server is installed.

  19. The following user says thank you to saa7_go for this useful post:

    babygal (12th August 2010)

  20. #16
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Yayyy..Happy news ...it works ..my program can now connect to the mysql database on another server.
    Thanks a million. and thanks for the patience replying my queries. Thanks!!!!

  21. #17
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by saa7_go View Post
    In this guide, there is a prerequisite:
    Download the MySQL installer (the essentials msi-package is enough) from MySQL.com and install it (make sure to choose to install the headers as-well.
    But there are many downloads in that site MySQL.com . Which one do I choose?

  22. #18
    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: QMYSQL database driver installation files

    take the MySQL Community Server. It will have all necessary files.

  23. #19
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    Quote Originally Posted by Lykurg View Post
    take the MySQL Community Server. It will have all necessary files.
    i downloaded and installed : mysql-5.1.49 - win32.msi

  24. #20
    Join Date
    Apr 2010
    Location
    Singapore
    Posts
    156
    Thanks
    47
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL database driver installation files

    I'm not able to execute the command 'reimp' as per the instruction in the link . And where can I get the download files for the reimp?

    Goto the sub-directory lib/opt and run reimp libmysql.lib to produce the liblibmysql.a file. This is the import library to use with MinGW.

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, 15:00
  2. QMYSQL driver not loaded
    By cydside in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2010, 02:18
  3. QMYSQL driver
    By pcaeiro in forum Qt Programming
    Replies: 2
    Last Post: 3rd September 2009, 14:35
  4. QMYSQL driver not loaded
    By sepehr in forum Qt Programming
    Replies: 12
    Last Post: 11th January 2009, 20:15
  5. QMYSQL driver
    By Fastman in forum Installation and Deployment
    Replies: 2
    Last Post: 26th October 2007, 08:14

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.