Results 1 to 6 of 6

Thread: problem with mysql drivers windows

  1. #1
    Join Date
    Sep 2009
    Posts
    31
    Thanks
    7
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with mysql drivers windows

    Hello everybody,

    I'm trying to install the MySQL drivers for Qt on Windows 7.
    I have already installed MinGW, Qt, QtCreator, MySQL connector and MySQL Server. I'm following the steps in doc "SQL Database Drivers" which comes in QtCreator.

    The steps are:
    - Install MinGW-5.1.6.exe in, e.g. C:\MinGW.
    - Extract mingw-utils-0.3.tar.gz into, e.g. C:\MinGW.
    - Add the path for MinGW-5.1.6.exe to your PATH variable, e.g. C:\MinGW\bin;
    - Extract the Qt sources, (qt-everywhere-opensource-src-4.6.2.zip), into, e.g. C:\Qt.
    - Add the path for the eventual Qt binary to your PATH variable, e.g. C:\Qt\4.6.2\bin;.
    - Install MySQL (mysql-5.1.35-win32.msi), customizing the components. Select only the headers and libraries. Install in, e.g. C:\MySQL\MySQL51.
    - Open the DOS prompt, go to C:\MySQL\MySQL51\lib\opt, and run the following commands:
    reimp -d libmysql.lib
    dlltool -k -d libmysql.def -l libmysql.a
    - Open the DOS prompt, go to C:\Qt\4.6.2 and run the following commands:
    configure.exe -debug-and-release -platform win32-g++ -qt-sql-mysql -l mysql -I C:\MySQL\MySQL51\include -L C:\MySQL\MySQL51\lib\opt
    mingw32-make sub-src
    This step takes a long time.
    - Open the DOS prompt, go to C:\Qt\4.6.2\src\plugins\sqldrivers\mysql and run the following command:
    qmake "INCLUDEPATH+=C:\MySQL\MySQL51\include" "LIBS+=-L. mysql" mysql.pro
    - Now the following libraries are ready in C:\Qt\4.6.2\plugins\sqldrivers.
    libqsqlmysql4.a
    libqsqlmysqld4.a
    qsqlmysql4.dll
    qsqlmysqld4.dll
    - To use the SDK and QtCreator directly, copy these libraries to your C:\Qt\...\qt\plugins\sqldrivers\, and copy C:\MySQL\MySQL51\lib\opt\libmysql.dll to your C:\Qt\...\qt\bin\.

    In step configure.exe and mingw32 an error occurs in a file claiming qsql_mysql.h.
    Then inside that file has an include that does not exist, mysql.h. Then I copy the mysql.h that comes with the MySQL server and continue the problem.

    What the solution?


    Added after 57 minutes:


    I tried with the mysql binary files and still continue the problem.
    In step mingw32 show:
    C:\Qt\2010.05\qt\src\sql/drivers/mysql/qsql_mysql.cpp:312: undefined reference to `mysql_stmt_errno@4'
    ./tmp\obj\debug_shared\qsql_mysql.o:C:\Qt\2010.05\qt \src\sql/drivers/mysql/qsql_mysql.cpp:358: undefined reference to `mysql_stmt_result_metadata@4'
    ...

    when do the qmake,
    C:\Qt\2010.05\qt\src\plugins\sqldrivers\mysql>qmak e "INCLUDEPATH+=C:\mysql-connector-c-noinstall-6.0.2-winx64\include" "LIBS+=-L. mysql" mysql.pro
    show:
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.
    WARNING: (internal):1: Unescaped backslashes are deprecated.

    In the C:\Qt\...\plugins\sqldrivers no have files qsqlmysql4.dll, qsqlmysqld4.dll.
    Last edited by danilodsp; 4th June 2011 at 21:30.

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with mysql drivers windows

    Looks like your mysql driver is not loaded. Only qmake will not do it. You will have to build it too. also replace the forward slashes with backslashes... c if it works...

  3. #3
    Join Date
    Sep 2009
    Posts
    31
    Thanks
    7
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with mysql drivers windows

    I think I'll quit.
    I tried several ways and could not.
    I will try to use API MySQL for C/C++.

  4. #4
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with mysql drivers windows

    Due to licensing issues Qt doesn't bundle the dll's. It makes life a little difficult for those who are starting with databases other than sqlite. I faced similar issues when integrating Firebird(Ibase) and postgre. But once done the qt api is miles ahead than any other api for database connectivity and implementation logic. You might want to persist and ask the right questions, the informative people in this forum will make it through....Just my 2cents...

  5. #5
    Join Date
    Sep 2009
    Posts
    31
    Thanks
    7
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with mysql drivers windows

    Quote Originally Posted by pkj View Post
    Due to licensing issues Qt doesn't bundle the dll's. It makes life a little difficult for those who are starting with databases other than sqlite. I faced similar issues when integrating Firebird(Ibase) and postgre. But once done the qt api is miles ahead than any other api for database connectivity and implementation logic. You might want to persist and ask the right questions, the informative people in this forum will make it through....Just my 2cents...
    hmm .. ok.
    So I will persist.

    Initially I apologize for my English.

    From the beginning.
    I'm following the docs with the title "How to build the MySQL driver for MinGW users".
    He says to install:
    - MinGW-5.1.6.exe
    - mingw-utils-0.3.tar.gz
    - Qt sources, eg qt-everywhere-opensource-src-4.6.2.zip
    - mysql-5.1.35-win32.msi

    In QT, I installed "qt-sdk-win-opensource-2010.05" which I believe is the same thing, but now I'm suspicious that Qt sources has more something.
    The doc talks about a win32, the my is win64, I believe that no problem.

    Everyone talks about the directory "C:\MySQL\MySQL51\lib\opt", but in my disk that does not exist. Here is "C:\Program Files\MySQL\MySQL Server 5.5\lib" do not have the directory "opt".

    Now I will reinstall everything and try again.

  6. #6
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with mysql drivers windows

    Best of luck... You may want to see these links... Thread on mysql on xp and How to mysql on qt Also ... while compiling library for sql, pro file should be able to see into the headers of mysql and libs should point to dlls. You may have to change the pro file accordingly.

Similar Threads

  1. Mysql drivers
    By thahir1986 in forum Newbie
    Replies: 2
    Last Post: 26th October 2010, 07:07
  2. Building MySQL QT Drivers on Windows XP
    By cia.michele in forum Newbie
    Replies: 6
    Last Post: 16th August 2010, 18:54
  3. Installing QT in windows with mysql drivers
    By roncriss in forum Installation and Deployment
    Replies: 0
    Last Post: 20th November 2009, 03:45
  4. mysql drivers for QT-4.5.2
    By jsmith in forum Qt Programming
    Replies: 1
    Last Post: 31st August 2009, 11:33
  5. Need to compile with MySQL drivers/plugins
    By mongenix in forum Newbie
    Replies: 5
    Last Post: 6th January 2007, 20:24

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.