Results 1 to 20 of 26

Thread: Problem Wtih Connecting MySQL Database on Windows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Posts
    39
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Problem Wtih Connecting MySQL Database on Windows

    Hi to all,


    I am developing an application using Qt and my database is MySQL on windows. I gone through SQL Database Driver in Qt Assistance provided by Trolltech. Here i found that i need to create plugin for MySQL.

    I followed the instructions provided in the Qt Assistance as follows:


    cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake -o Makefile "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\opt\libmysql.lib" mysql.pro
    nmake

    I am getting the following error:

    C:\Qt\4.3.4\src\plugins\sqldrivers\mysql>nmake
    'nmake' is not recognized as an internal or external command,
    operable program or batch file.


    Can any one resolve my problem

    Waiting for your reply.

    Regards,

    Narasimha Raju. Naidu

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    open VS command prompt and run these commands again.
    the command prompt is located Start->All programms->Microsoft Studio Visual Studio->Visual Studio Tools.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Feb 2009
    Posts
    39
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    Thanks for your reply.

    I am using MingW and i tried to compile and i am getting the following error.

    Qt Code:
    1. C:\Qt\4.3.4\src\plugins\sqldrivers\mysql>qmake -o Makefile "INCLUDEPATH+=C:\prog
    2. ra~1\MySQL\include" "LIBS+=C:\progra~1\lib\opt\libmysql.lib" mysql.pro
    3.  
    4. C:\Qt\4.3.4\src\plugins\sqldrivers\mysql>mingw32-make
    5. mingw32-make -f Makefile.Release
    6. mingw32-make[1]: Entering directory `C:/Qt/4.3.4/src/plugins/sqldrivers/mysql'
    7. g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
    8. -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_NO_DEBUG -DQT_PLUGIN
    9. -DQT_SQL_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -
    10. I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"..\..\..\..\inclu
    11. de\QtSql" -I"..\..\..\..\include" -I"c:\progra~1\MySQL\include" -I"c:\Qt\4.3.4\i
    12. nclude\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"..\..\..\..\mkspecs\win32-g
    13. ++" -o tmp\obj\release_shared\main.o main.cpp
    14. In file included from main.cpp:46:
    15. ../../../sql/drivers/mysql/qsql_mysql.h:54:19: mysql.h: No such file or director
    16. y
    17. In file included from main.cpp:46:
    18. ../../../sql/drivers/mysql/qsql_mysql.h:105: error: expected `)' before '*' toke
    19. n
    20. mingw32-make[1]: *** [tmp/obj/release_shared/main.o] Error 1
    21. mingw32-make[1]: Leaving directory `C:/Qt/4.3.4/src/plugins/sqldrivers/mysql'
    22. mingw32-make: *** [release] Error 2
    To copy to clipboard, switch view to plain text mode 


    can you help me out.

    Regards,

    Narasimha Raju. Naidu

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    you have to create a static lib of MySQL which MinGW can recognize.
    read this how to do this. when you will create a static lib for MinGW then repeat your steps again.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Feb 2009
    Posts
    39
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    Thanks for your reply

    I gone through the instructions and downloaded impdef, copied in to C:\MingW\bin. Then i executed the following command and i got the following error.

    Qt Code:
    1. C:\MinGW\bin>dlltool --dllname libmysql.dll --def libmysql.def --output-lib libm
    2. ysql.a
    3. dlltool: Can't open def file: libmysql.def
    4.  
    5. C:\MinGW\bin>
    To copy to clipboard, switch view to plain text mode 

    Waiting for your reply

    Regards,

    Narasimha Raju.Naidu

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    use this tool.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #7
    Join Date
    Feb 2009
    Posts
    39
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    Thanks for your reply.

    I downloaded the file and extracted at C:\MinGW\bin. and executed the command but still i am getting the same error.


    Regards,

    Narasimha Raju. Naidu

  8. #8
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    did you rename a file in archive from impdef_tar to impdef.tar?
    did you create libmysql.def using impdef libmysql.dll > libmysql.def?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  9. #9
    Join Date
    Feb 2009
    Posts
    39
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    Thanks for your reply,

    I successfully created libmysql.def file. what should i do now. Where should i keep this file. Right now this file is at C:\MinGW\bin.

    Waiting for your reply

    Regards,

    Narasimha Raju. Naidu

  10. #10
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    1. navigate to MYSQLDIR\lib\opt
    cd MYSQLDIR\lib\opt
    2. impdef libmysql.dll > libmysql.def
    3. dlltool --dllname libmysql.dll --def libmysql.def --output-lib libmysql.a
    4. navigate to QTDIR\src\plugins\sqldrivers\mysql
    cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=MYSQLDIR\include" "LIBS+=MYSQLDIR\lib\opt\libmysql.a" mysql.pro
    mingw32-make
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  11. #11
    Join Date
    Feb 2009
    Posts
    39
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem Wtih Connecting MySQL Database on Windows

    Thanks for your reply,

    According to your instructions i navigated my current directory to mysqldir\lib\opt
    and tried to compile and i got the following error


    C:\PROGRA~1\MySQL\MySQL Server 5.0\lib\opt>dlltool --dllname libmysql.dll --def
    libmysql.def --output-lib libmysql.a
    'dlltool' is not recognized as an internal or external command,
    operable program or batch file.


    i set path for environment varibales for C:\MingW\bin. still i am getting the same error.

    What should i do now.

    I am waiting for your reply.

    Regards,

    Narasimha Raju. Naidu

Similar Threads

  1. Replies: 19
    Last Post: 3rd April 2009, 23:17
  2. Accessing xampp mysql database
    By synack in forum Newbie
    Replies: 8
    Last Post: 19th March 2009, 09:08
  3. MySQL starting problem
    By shamik in forum General Discussion
    Replies: 5
    Last Post: 25th April 2007, 07:20
  4. Qt in windows and mysql !!!
    By probine in forum Installation and Deployment
    Replies: 13
    Last Post: 9th December 2006, 07:42
  5. Deploying with MySQL support under Windows
    By KShots in forum Installation and Deployment
    Replies: 1
    Last Post: 12th October 2006, 09:19

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.