DB2 driver for centos8 built with Qt 5.9.8 not working .
-
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 ?
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.
-
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 ?
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.
-
@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?
-
@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.
-
@Gurubg You can try to search for the message text in the source code of that app to see when it is shown.
@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 -
@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 -
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?
-
@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
-
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 ?