if(!db.isValid())
{
qCritical() << "Initial connection invalid!";
}
db.setHostName("192.168.1.2");
db.setPort(3306);
db.setUserName("kOf_GetUsers");
db.setPassword("");
db.setDatabaseName("kOferta");
db.setConnectOptions("CLIENT_SSL=1;CLIENT_IGNORE_SPACE=1;MYSQL_OPT_RECONNECT=1");
MYSQL *handle = static_cast<MYSQL *>(v.data());
qDebug() << "connName:" << db.connectionName();
qDebug() << "driver:" << db.driverName();
qDebug() << "options:" << db.connectOptions();
qDebug() << "host:" << db.hostName();
db.driver()->dumpObjectInfo();
db.driver()->dumpObjectTree();
qDebug() << "database error:" << db.lastError().databaseText();
qDebug() << "driver error:" << db.lastError().driverText();
qDebug() << "v.typename:" << v.typeName();
qDebug() << "handle:" << handle;
qDebug() << "mysql error:" << mysql_error(handle);
try
{
qDebug() << "mysql ping:" << mysql_ping(handle);
qDebug() << "mysql error:" << mysql_error(handle);
// mysql_ssl_set(handle, ":/client-key", ":/client-cert", ":/ca-cacert", NULL, NULL);
// mysql_ssl_set(handle, "D:/git/build-kOferta/client-key.pem", "D:/git/build-kOferta/client-cert.pem", "D:/git/build-kOferta/ca-cacert.pem", "D:/git/build-kOferta/", "DHE-RSA-AES256-SHA");
}
catch (std::exception& e)
{
qCritical() << "[mysql_ssl_set] Standard exception: " << e.what();
}
catch(...)
{
qCritical() << "[mysql_ssl_set] Unknown exception";
}
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "initialConnection");
if(!db.isValid())
{
qCritical() << "Initial connection invalid!";
return QStringList();
}
db.setHostName("192.168.1.2");
db.setPort(3306);
db.setUserName("kOf_GetUsers");
db.setPassword("");
db.setDatabaseName("kOferta");
db.setConnectOptions("CLIENT_SSL=1;CLIENT_IGNORE_SPACE=1;MYSQL_OPT_RECONNECT=1");
QVariant v = db.driver()->handle();
MYSQL *handle = static_cast<MYSQL *>(v.data());
qDebug() << "connName:" << db.connectionName();
qDebug() << "driver:" << db.driverName();
qDebug() << "options:" << db.connectOptions();
qDebug() << "host:" << db.hostName();
db.driver()->dumpObjectInfo();
db.driver()->dumpObjectTree();
qDebug() << "database error:" << db.lastError().databaseText();
qDebug() << "driver error:" << db.lastError().driverText();
qDebug() << "v.typename:" << v.typeName();
qDebug() << "handle:" << handle;
qDebug() << "mysql error:" << mysql_error(handle);
try
{
qDebug() << "mysql ping:" << mysql_ping(handle);
qDebug() << "mysql error:" << mysql_error(handle);
// mysql_ssl_set(handle, ":/client-key", ":/client-cert", ":/ca-cacert", NULL, NULL);
// mysql_ssl_set(handle, "D:/git/build-kOferta/client-key.pem", "D:/git/build-kOferta/client-cert.pem", "D:/git/build-kOferta/ca-cacert.pem", "D:/git/build-kOferta/", "DHE-RSA-AES256-SHA");
}
catch (std::exception& e)
{
qCritical() << "[mysql_ssl_set] Standard exception: " << e.what();
}
catch(...)
{
qCritical() << "[mysql_ssl_set] Unknown exception";
}
To copy to clipboard, switch view to plain text mode
And my log is as follows:
Bookmarks