Results 1 to 13 of 13

Thread: Connection to MySQL

  1. #1
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Connection to MySQL

    Hi, I am using Qt 4.7.2 in Simulator whic ll run in my W Vista. I ve been trying to connect to MySQL Server 5.1. Since i was getting "Driver not loaded" error i tried the steps in trolltech. I am getting both make and nmake command not found.
    I am new to this programming. Please help me to connect to the database. Guide me from the first step. Any database if i am able to connect easily that is very helpful to me. Thank u.

  2. #2
    Join Date
    Feb 2011
    Location
    Romania
    Posts
    53
    Thanks
    1
    Thanked 11 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Connection to MySQL

    1. download mysql-connector-c-noinstall-6.0.2-win32 binary package from mysql downloads.
    2. open %QTDIR%\src\plugins\sqldrivers\mysql\mysql.pro in QtCreator
    3. add LIBS and INCLUDEPATH in mysql.pro to match with your mysql-connector-c-noinstall-6.0.2-win32 path
    4. after mysql.pro is succesfully build, copy the qsqlmysqld4.dll in %QTDIR%\Desktop\...etc...\plugins\sqldrivers (there should already be qsqlite4.dll)
    5. copy libmysql.dll in %QTDIR%\Desktop\...etc...\bin

    that's all

  3. The following 3 users say thank you to cincirin for this useful post:

    deepal_de (22nd January 2012), giriuvce (27th May 2011), sakya (18th July 2011)

  4. #3
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Connection to MySQL

    Sorry to ask this sir. Where can i get qsqlmysqld4.dll. Other steps i did successfully. Thank u

  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: Connection to MySQL

    You'll find qsqlmysqld4.dll where you run make at the 4th step. Look at the debug/release folder.

  6. #5
    Join Date
    Feb 2011
    Posts
    64
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Connection to MySQL

    %QTDIR%\src\plugins\sqldrivers\mysql\release
    Production version, smaller then debug version.
    %QTDIR%\src\plugins\sqldrivers\mysql\debug
    Debug version.

  7. #6
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Connection to MySQL

    [tmp/moc/release_shared/qsql_mysql.moc] error 1
    I'm getting this error when i build. Really, I lost my hope to connect to mysql server. I tried many suggestions in different links. 1ce again i want to make u clear that i'm running Qt 4.7.2 Simulator. Thank u for reply.

  8. #7
    Join Date
    Apr 2011
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Connection to MySQL

    The above error comes when i build using qtcreator.
    I found the same error when i run in the command prompt in this link.
    http://www.siteduzero.com/forum-83-6...bdd-mysql.html
    I think they have solved this problem. But i didnt understand their language.

  9. #8
    Join Date
    May 2010
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Connection to MySQL

    Quote Originally Posted by giriuvce View Post
    The above error comes when i build using qtcreator.
    I found the same error when i run in the command prompt in this link.
    http://www.siteduzero.com/forum-83-6...bdd-mysql.html
    I think they have solved this problem. But i didnt understand their language.
    He had problem with INCLUDEPATH parameter due to missing backslash after C:.
    If you post your printout of error and the command you try to give, then we might know more to give you some solution.

  10. #9
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Connection to MySQL

    I am getting this error...error: 'my_ulonglong' does not name a type. While following the above steps.

  11. #10
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Connection to MySQL

    Then you almost certainly skipped step 3 or got the values wrong.

  12. #11
    Join Date
    Nov 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default Re: Connection to MySQL

    i'm getting an error when i build the .pro.
    It says qsqlmysqld4.dll not found. What shud i do?


    Added after 17 minutes:


    i had given a wrong path. Now it says -llibmysql not found
    I've been tryin a lot of stuff but cant build d plugin properly, wat do i have to do?
    Last edited by Greeshma; 12th November 2011 at 05:49.

  13. #12
    Join Date
    Jan 2011
    Location
    Sri Lanaka
    Posts
    64
    Thanks
    39
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Connection to MySQL

    hi,

    well this steps worked fine.
    1. download mysql-connector-c-noinstall-6.0.2-win32 binary package from mysql downloads.
    2. open %QTDIR%\src\plugins\sqldrivers\mysql\mysql.pro in QtCreator
    3. add LIBS and INCLUDEPATH in mysql.pro to match with your mysql-connector-c-noinstall-6.0.2-win32 path
    4. after mysql.pro is succesfully build, copy the qsqlmysqld4.dll in %QTDIR%\Desktop\...etc...\plugins\sqldrivers (there should already be qsqlite4.dll)
    5. copy libmysql.dll in %QTDIR%\Desktop\...etc...\bin

    but when i run my app its says "QSqlDatabase: QMYSQL driver not loaded"

  14. #13
    Join Date
    Jan 2012
    Location
    Argentina
    Posts
    167
    Thanks
    33
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Connection to MySQL

    i had to erase every wrong step i made to actually generate all the files...i had the same problem with the nmake...i m using minGW so instead of nmake i have to run mingw32-make and voila everything went ok...

    http://www.qtcentre.org/threads/4696...ht=#post212132

    maybe this helps...

  15. The following user says thank you to KillGabio for this useful post:

    deepal_de (30th August 2015)

Similar Threads

  1. Regarding MYSQL connection
    By sudheer168 in forum Qt Programming
    Replies: 3
    Last Post: 16th October 2009, 15:34
  2. mysql 5 connection
    By GuL in forum Newbie
    Replies: 37
    Last Post: 18th August 2008, 15:11
  3. Mysql connection
    By yesraaj in forum Newbie
    Replies: 2
    Last Post: 23rd February 2007, 05:57
  4. Connection with MySql
    By vishva in forum Qt Programming
    Replies: 2
    Last Post: 31st July 2006, 11:58

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.