Hallo


I got some failures with QMYSQL (QSQLITE will work)

My connection will be

Qt Code:
  1. if (dbType == "QSQLITE") {
  2. currentConnection = QSqlDatabase::addDatabase("QSQLITE", "CN");
  3. currentConnection.setDatabaseName(QString(dataDir + "/%1-%2.db").arg(date.year()).arg(basename));
  4. } else if (dbType == "QMYSQL") {
  5. QString userName = settings.value("DB_userName", "QRK").toString();
  6. QString password = settings.value("DB_password", "").toString();
  7. QString hostName = settings.value("DB_hostName", "localhost").toString();
  8.  
  9. currentConnection = QSqlDatabase::addDatabase("QMYSQL", "CN");
  10. currentConnection.setHostName(hostName);
  11. currentConnection.setUserName(userName);
  12. currentConnection.setPassword(password);
  13. currentConnection.setConnectOptions("MYSQL_OPT_RECONNECT=1;MYSQL_OPT_CONNECT_TIMEOUT=86400;MYSQL_OPT_READ_TIMEOUT=60");
  14. }
  15.  
  16. bool ok = currentConnection.open();
To copy to clipboard, switch view to plain text mode 

When i was connected i got, but not allways a SIGSEGV. When i remove the connection options i got "Lost connection to MySQL server during query"
no matter if MySQL Server is localhost or any Server on the Internet.

Yes, i search but found no solution. What can i do false?

OS: Linux Ubuntu (16.04 and 17.10) Server MariaDB from the Ubuntu Package

A Simply Query which returns one record and the Database holds max. 10 Entries.

Qt Code:
  1. QSqlDatabase dbc = QSqlDatabase::database("CN");
  2. QSqlQuery query(dbc);
  3.  
  4. query.prepare("SELECT strValue FROM globals WHERE name='shopName'");
  5. query.exec();
  6. query.next();
  7.  
  8. name = query.value(0).toString();
To copy to clipboard, switch view to plain text mode 


thx Chris