Skip to content
  • 0 Votes
    10 Posts
    2k Views
    M
    @JonB said in Qt Mysql [Mysql Server has gone away] and Silent failures after query exec(): @mvsri said in Qt Mysql [Mysql Server has gone away] and Silent failures after query exec(): like 10+ hours any statements like update or insert doesn't work. This may be significant. From your INSERT example you are using prepare() and you are binding variables. Please read https://forum.qt.io/topic/107690/lost-connection-to-mysql-server-during-query-qmysql3-unable-to-reset-statement carefully. There the suggestion is that this may fail to reconnect even with the reconnection option. If your problem is reproducible can you, at least temporarily/as a test change to make the query a string with whatever in it and abandon preparation and variable substitution? Does that make the problem go away? Furthermore, you check the result of exec() but when you do use prepare() you do not check the result it returns. You should do so. That may reveal an error at that stage. Also, given that abandonment of MYSQL_OPT_RECONNECT has either happened or is about to happen, you might remove this from your code and do whatever you have to manage reconnection yourself, to see whether that improves the situation. I do not know why your other audit log connection appears to work while your main one fails. Even more complex is your "writes to MySQL via QtConcurrent::run". I was under the impression that Qt requires you to write to a SQL connection from the same thread as where it was created/currently lives, won't QtConcurrent::run() break precisely that rule? Yet that one works. Who knows?! I have gone through this thread: https://forum.qt.io/topic/107690/lost-connection-to-mysql-server-during-query-qmysql3-unable-to-reset-statement/6. In my case, I’ve been using QString to build the query and pass it to the functions in databaseconnector class and passing it to QSqlQuery. To recreate the issue, I restarted the MySQL server from Services (windows), and I received the same error: Lost connection to MySQL server during query QMYSQL: Unable to execute query" (:0, ) After this, I implemented reconnection logic that attempts to reconnect if QSqlQuery::exec() fails and give connection error. When I recreated the same scenario (restarting the MySQL server), the reconnection worked as expected. Based on suggestions and further reading of the documentation, I’ve also modified my code to avoid holding the QSqlDatabase instance as a class variable and instead use it as a function-local variable. Regarding the AuditLogger class, I’ve completely reimplemented it and now use QMetaObject::invokeMethod for logging operations. While reviewing the documentation and googling for MYSQL_OPT_RECONNECT, it appears this option may no longer work as expected with recent versions. So, I’m considering removing it from the code. One pending task is to check the MySQL server logs—I haven’t received them yet, but once I do, I’ll analyze them for further insight. One doubt I have is: The system where the application is running is part of a domain network, governed by Group IT policies, and has antivirus installed. Could this environment be a potential cause for the dropped connection? (I understand this might be a naive question, but I’d like to rule out any possible cause.) Thank you again for your inputs—they’ve helped clarify several concepts for me.
  • 0 Votes
    13 Posts
    2k Views
    SGaistS
    That was a nasty one. Glad you found out and thanks for sharing !
  • 0 Votes
    3 Posts
    1k Views
    J
    I looked these but, I could not understand anything. I need some example @jsulm said in Add external library Cmake Windows: Do you also have the *.lib files for these libs there? You can't link *.dll files, for linking you need *.lib. Yes I have all files
  • 0 Votes
    3 Posts
    854 Views
    C
    Thanks for your reply. One thing to note is that if I hadn't turned on the virtual keyboard on MacOS, this Dialog destruction wouldn't have caused the program to crash.
  • 0 Votes
    11 Posts
    2k Views
    P
    @J-Hilk yeah, thank you !
  • 0 Votes
    5 Posts
    3k Views
    F
    Thanks for the hint, I did sudo apt remove qt5* libqt5* and that solved my problem. The system QT5 was too old.
  • bluetooth low energy error

    Unsolved QML and Qt Quick qt5.15.2 bluetooth le
    1
    0 Votes
    1 Posts
    318 Views
    No one has replied
  • 0 Votes
    4 Posts
    1k Views
    JoeCFDJ
    @chenPeng First, you need to click Download OpenSSL Button to install android_openssl.
  • 0 Votes
    3 Posts
    1k Views
    P
    Hello! Updating from my side. Thank you @SGaist for your answer, for future people facing the same issue: I did not have any uncommon character in the paths more than underscores. My fix: I figured with some help and testing deploying to other folder structures that qmake was the problem and complaining. Placing the whole project one level up (C:\Repos\NewLevel\ ...) fixed the issue and no problem from Qt whatsoever. It is purely a workaround that Qt seems to be ok with. As my version control begins after NewLevel, it is also not an issue. Maybe I will try in the future to take it down one level after some update in Qt, but AFAIK it is not a reported bug. As I said, other machines with identical Project Strcture using same Qt Version and QtCreator seemed to be okay with that. The Makefiles look also the same in terms of relative paths.
  • How to read INI file

    Unsolved General and Desktop ini qt5.15.2
    10
    0 Votes
    10 Posts
    2k Views
    JonBJ
    @Ketan__Patel__0011 :) OK. This thread is asking about a particular problem, "duplicate keys", which I don't think QSettings will handle as the OP wishes.
  • QTextTospeech can't found engines

    Solved General and Desktop qtexttospeech linux qt5.15.2
    12
    0 Votes
    12 Posts
    3k Views
    .
    @jsulm I finally found my mistake, I'm missing the install qtspeech5-flite-plugin Thank you
  • How to clear plot in QCustomPlot?

    Solved General and Desktop qcustomplot plot vector qt5.15.2
    2
    0 Votes
    2 Posts
    950 Views
    timob256T
    @timob256 In general , there was one mistake , for some reason I thought that by setting the size of the vector , it would correct everything itself , but it turned out not to be so void MainWindow::slotProcessDatagrams() { QByteArray baDatagram_in; do { baDatagram_in.resize(m_pudp_in->pendingDatagramSize()); m_pudp_in->readDatagram(baDatagram_in.data(), baDatagram_in.size()); } while(m_pudp_in->hasPendingDatagrams()); QDataStream in(&baDatagram_in, QIODevice::ReadOnly); in.setVersion(QDataStream::Qt_5_3); in >> str_priem; // принимаем сообщение str_x = str_priem.section(' ',0,0); str_y = str_priem.section(' ',1); if(my_int >= 80) { // clear firs element // x.pop_back(); // y.pop_back(); // x.removeLast(); // y.removeLast(); x.pop_front(); //последний из вектора y.pop_front(); x << str_x.toDouble(); y << str_y.toDouble(); } else { x << str_x.toDouble(); y << str_y.toDouble(); my_int = my_int + 1; } // чистим старое отрисовываем новое wGraphic->graph(0)->clear(); wGraphic->graph(0)->rescaleAxes(); // wGraphic->replot(); // Отрисовываем содержимое полотна wGraphic->graph(0)->setData(y,x); // Устанавливаем координаты точек графика wGraphic->replot(); // Отрисовываем содержимое полотна // Очищаем принятую строку str_priem.clear(); } True, a new error jumped (for some reason the last and first point somehow connects, I don't know how to break) [image: R3rvJ.png]
  • why is data not transmitted over udp?

    Solved General and Desktop qt5.15.2 udp
    5
    0 Votes
    5 Posts
    892 Views
    timob256T
    @timob256 this work QString data_str = QString::number(data_x)+ " "+QString::number(data_y); out << data_str; qDebug() <<data_str ; [image: MxYj4.png]
  • 0 Votes
    3 Posts
    2k Views
    timob256T
    @timob256 Perhaps it was necessary to connect #include <QtNetwork> previously, the header was without #include <QtNetwork> now it looks like this #include <QMainWindow> #include "qcustomplot.h" #include <QtNetwork> #include <QHostInfo> #include <QNetworkInterface> #include <QUdpSocket> #include <QAbstractSocket> #include <QHostAddress> #include <QTime> #include <QTimer> #include <QVector> #include <QtMath> However, he does not transmit much data yet ж_ж
  • 0 Votes
    1 Posts
    517 Views
    No one has replied
  • 0 Votes
    1 Posts
    431 Views
    No one has replied
  • 0 Votes
    5 Posts
    2k Views
    bibasmallB
    @sierdzio You are absolutely right, thank you. I didn't know about the nmake install command :)
  • 0 Votes
    4 Posts
    1k Views
    SGaistS
    The online installer provides 5.15.2. It also provides a more recent version of Qt Creator which might work better than the one you are currently using.