Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. DB2 driver for centos8 built with Qt 5.9.8 not working .
Forum Updated to NodeBB v4.3 + New Features

DB2 driver for centos8 built with Qt 5.9.8 not working .

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
10 Posts 3 Posters 1.7k Views
  • 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.
  • G Offline
    G Offline
    Gurubg
    wrote on last edited by Gurubg
    #1

    I have to port a CentOS 6 application to CentoOS 8.

    I was able to compile the qt4 application in qt5 with some changes in source.
    Later I built the driver for DB2 v11 and tried to run tehe application.
    But it throws some wierd error in chinese and I am not able to figure out the issue.
    Can someone give a hint how I can find the root cause ?

    ![alt text](c08fc2f4-6952-4742-a9bb-c6a6d305c005-image.png image url)

    There is no issue with DB conenction/credentials as the same is working fine if I use qt4 db2 driver , it connects to DB but the GUI is mising some images/themes.

    jsulmJ 1 Reply Last reply
    0
    • G Gurubg

      I have to port a CentOS 6 application to CentoOS 8.

      I was able to compile the qt4 application in qt5 with some changes in source.
      Later I built the driver for DB2 v11 and tried to run tehe application.
      But it throws some wierd error in chinese and I am not able to figure out the issue.
      Can someone give a hint how I can find the root cause ?

      ![alt text](c08fc2f4-6952-4742-a9bb-c6a6d305c005-image.png image url)

      There is no issue with DB conenction/credentials as the same is working fine if I use qt4 db2 driver , it connects to DB but the GUI is mising some images/themes.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Gurubg If I understand you correctly you do not speak Chinese, right? Me neither :-) Did you try to use Google Translate to translate the content of the message box?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Gurubg If I understand you correctly you do not speak Chinese, right? Me neither :-) Did you try to use Google Translate to translate the content of the message box?

        G Offline
        G Offline
        Gurubg
        wrote on last edited by
        #3

        @jsulm Ofcourse , the first thing I did was to try to translate the message in google. But even google can't translate it . So I thought I should seek help in this forum.

        jsulmJ 1 Reply Last reply
        0
        • G Gurubg

          @jsulm Ofcourse , the first thing I did was to try to translate the message in google. But even google can't translate it . So I thought I should seek help in this forum.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Gurubg You can try to search for the message text in the source code of that app to see when it is shown.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          G 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Gurubg You can try to search for the message text in the source code of that app to see when it is shown.

            G Offline
            G Offline
            Gurubg
            wrote on last edited by
            #5

            @jsulm its not from the app, its the sqlerror from QSqlDatabase::lastError().text() . code is something like below
            m_sampledb = QSqlDatabase::addDatabase(strtargetstr.toStdString().c_str());
            m_sampledb.setHostName (strserverinfolist.at(0).toLocal8Bit ().constData());
            m_sampledb.setDatabaseName (strdbnamestr.toStdString().c_str());
            m_sampledb.setUserName (strusernamestr.toStdString().c_str());
            m_sampledb.setPassword (strpasswordstr.toStdString().c_str());
            m_sampledb.setPort (strserverinfolist.at(1).toInt());

            if (!m_sampledb.open()) {
            QMessageBox::critical (0, QObject::tr ("Database Error"), m_sampledb.lastError().text ());
            return false;
            }
            --> This used to work perfectly in CentOS 6

            jsulmJ 1 Reply Last reply
            0
            • G Gurubg

              @jsulm its not from the app, its the sqlerror from QSqlDatabase::lastError().text() . code is something like below
              m_sampledb = QSqlDatabase::addDatabase(strtargetstr.toStdString().c_str());
              m_sampledb.setHostName (strserverinfolist.at(0).toLocal8Bit ().constData());
              m_sampledb.setDatabaseName (strdbnamestr.toStdString().c_str());
              m_sampledb.setUserName (strusernamestr.toStdString().c_str());
              m_sampledb.setPassword (strpasswordstr.toStdString().c_str());
              m_sampledb.setPort (strserverinfolist.at(1).toInt());

              if (!m_sampledb.open()) {
              QMessageBox::critical (0, QObject::tr ("Database Error"), m_sampledb.lastError().text ());
              return false;
              }
              --> This used to work perfectly in CentOS 6

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Gurubg So it fails to open db, but since I don't understand the message text I can't tell why.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • G Offline
                G Offline
                Gurubg
                wrote on last edited by
                #7

                Is there any issue with QT 5.11 and DB2 V11.5 ? This connection issue is hard nut to crack !

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Can you please tell us what the error message says? Best is to start it as en_US instead your locale. And why all this useless QString::toStdString().c_str() stuff in the connection setup code?

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  1
                  • G Offline
                    G Offline
                    Gurubg
                    wrote on last edited by
                    #9

                    @Christian-Ehrlicher said in DB2 driver for centos8 built with Qt 5.9.8 not working .:

                    en_US

                    I was able to print the error from qsql_db2.cpp ( I added printf) . [IBM][CLI Driver] SQL1024N A database connection does not exist. SQLSTATE=08003

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      Gurubg
                      wrote on last edited by Gurubg
                      #10

                      I found the issue , the problem was with db2/qsql_db2.cpp file which calls SQLDriverConnect with qToTChar(connQStr) param.
                      I enabled db trace and checked DB2 received only one char instead of the full connection string.
                      I changed it to (unsigned char ) connQStr.toLatin1().data()* and it worked.
                      Now the problem is the queries called from exec() function with below error

                      [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "s".  Expected tokens may include:  "JOIN <joined_table>".  SQLSTATE=42601
                      

                      Is QT5 by default UNICODE enabled ? how do I disable it ?

                      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