Results 1 to 5 of 5

Thread: MySQL and qt

  1. #1
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question MySQL and qt

    hello all!

    i've got a problem with connecting to a mysql database.

    i call
    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    2.  
    3. db.setHostName("127.0.0.1");
    4. db.setDatabaseName("blabla");
    5. db.setUserName("root");
    6. db.setPassword("1234567");
    7. db.setPort(3007);
    8. bool ok = db.open();
    9. if(!ok)
    10. QMessageBox::information(0,
    11. tr("Datenbankfehler"),
    12. sksdatabase.lastError().text());
    To copy to clipboard, switch view to plain text mode 

    but i get this error:quote:
    Cannot Connect to MySQL Server on 127.0.0.1(10061) QMYSQL:unable to connect
    the server is set up with my parameters, what can i do?

  2. #2
    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: MySQL and qt

    Quote Originally Posted by kernel_panic View Post
    [...]
    Qt Code:
    1. db.setPort(3007);
    To copy to clipboard, switch view to plain text mode 
    [...]
    the server is set up with my parameters, what can i do?
    Sorry, but is your mysql-server really accessable under port 3007. Isn't it normaly 3306?

    Lykurg

  3. #3
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL and qt

    all is set up with my parameters.
    i really don't know why qt can't connect

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: MySQL and qt

    If you're using Unix, what does "netstat -lp | grep 3007" return?

  5. #5
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL and qt

    i've solved my problem. thanks for help

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.