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

Thread: QMYSQL database driver installation files

  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

    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.

  5. #4
    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


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

    babygal (27th July 2010)

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

    Default Re: QMYSQL database driver installation files

    How can I be sure that the driver files are installed correctly?

  8. #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

    You can use QSqlDatabase::drivers() to check all of the available drivers.

  9. #7
    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?

  10. #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

    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.

  11. #9
    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 

  12. #10
    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.

  13. #11
    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.

  14. #12
    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!

  15. #13
    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?

  16. #14
    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.

  17. #15
    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

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

    Default Re: QMYSQL database driver installation files


    I download the mingw-utils in http://sourceforge.net/projects/ming...ar.gz/download .
    As per the guide : http://www.qtcentre.org/wiki/index.p...ws_using_MinGW
    the second prerequisite is : Download the mingw-utils .Copy the contents of the binary tar.gz to %QTDIR%/bin.
    My question is which bin folder exactly?There are a few bin folders. QT version I'm using is 2010.02.1

  19. #17
    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

    I assume your Qt installation is in C:\. So, copy your mingw-utils contents(in bin directory) in C:\Qt\2010.02.1\qt\bin.

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

    Default Re: QMYSQL database driver installation files

    I downloaded the MySQL Server 5.1 into path
    C:\Program Files\MySQL\MySQL Server 5.1 .

    But there is no \lib\opt\ in my :
    C:\Program Files\MySQL\MySQL Server 5.1\lib.

    Instruction from the guide link :-
    How to Build the Plug-in :
    -Open a Qt Command Prompt and go to wherever you installed the MySQL server (C:\Program Files\MySQL\MySQL Server 5.0 is the default location).
    -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.
    But I do not find any sub-directory lib/opt . So how do I proceed?

  21. #19
    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

    Is there libmysql.lib in your MySQL lib directory ?

  22. #20
    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
    Is there libmysql.lib in your MySQL lib directory ?



    No, there isn't ..

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.