Problem with coding used by MySQL in a TCP conexion.



  • Hola everyone.!

    Greetings is my first time, sorry if my post was solved but I don't found it something above this.
    and sorry for my english too.

    I build this in Windows 7 and Linux Ubuntu 14.04

    @// Funcion para conexion a la BD
    int mysqlJobs::dbCheckConexion(QString S, QString U, QString P)
    {
    if(QSqlDatabase::isDriverAvailable("QMYSQL")){
    QSqlDatabase myDB = QSqlDatabase::addDatabase("QMYSQL");
    myDB.setHostName(S);
    myDB.setUserName(U);
    myDB.setPassword(P);
    if(myDB.open())
    return 0;
    else
    return 1;
    }
    else
    return 2;
    }@

    When I build this, my function return 2. and my tcp connection al servidor is bad.

    Then I run Wireshark to see the anatomy packet that is sent for the QMYSQL Driver. and I see this:

    https://drive.google.com/file/d/0B-CJKFYsPPdZdkVUR0xPX05scTQ/edit?usp=sharing

    Please, look the Charset: latin1 COLLATE latin1_swedish_ci in the image...

    When I connect to my server with another mysql tool, like Mysql Workbench or Mysql Gui Tools and
    can log in without any problem. (sin problemas)

    But the packet coding used is other look the next image and see that coding used is UTF8

    https://drive.google.com/file/d/0B-CJKFYsPPdZSDBxcm5Zc2FDN1E/edit?usp=sharing

    How I can change this? am sure that my problem with my function is for this.

    Please help me with this problem.

    Gracias y Saludos.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Before being able to use the MySQL plugin you need to build it. You can search in this forum. The question has been answered many times. You also have the "sql driver guide":http://qt-project.org/doc/qt-5/sql-driver.html

    If you are using your distribution Qt you should also have a pre-built package for that.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.