Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Hello guys!! help me !! I try to connect mysql with qt but the qt don't open a conection read more!!
Forum Updated to NodeBB v4.3 + New Features

Hello guys!! help me !! I try to connect mysql with qt but the qt don't open a conection read more!!

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 808 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jhonjhon
    wrote on last edited by
    #1

    I dont't get to establish a connection with qt with mysql, i try a lot of way but don't open see de code

    @QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setDatabaseName("C:\ProgramData\MySQL\MySQL Server 5.5\data\usuarios\db.opt");
    db.setHostName("localhost");
    db.setPassword("");
    db.open();
    if(!db.open())
    ui->sinal->setText("disconected");
    else
    ui->sinal->setText("conected");@

    when will to compile always show disconected what did i do wrong?
    have someone to help me

    I put de librarys

    @#include <QMainWindow>
    #include <QtSql/QSqlDatabase>
    #include <QtSql>
    #include <QtSql/qsqldatabase.h>
    #include <QtSql/QSql>
    #include <QtDebug>
    #include <QtSql/qsql.h>@

    but don't connect

    qxoz: code tags @ added

    1 Reply Last reply
    0
    • J Offline
      J Offline
      junnellogbox.ph
      wrote on last edited by
      #2

      First thing First.
      Are you sure you have a QMYSQL driver?

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lack
        wrote on last edited by
        #3

        second, that database name doesn't look correct. the only db driver that needs file path is sqlite.

        third, no user name.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved