I am trying to connect my SQL Server to the qt project with this code
QString servername = "OLI-PC";
QString dbname = "Translator";
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setConnectOptions();
qDebug()<<"Dupa connection details";
QString dsn = QString("DRIVER={SQL SERVER};SERVER=%1;DATABASE=%2;Trusted_Connection=Yes").arg(servername).arg(dbname);
db.setDatabaseName(dsn);
qDebug()<<"Dupa set data base";
if(db.open())
{
qDebug()<<"open";
}
else
{
qDebug()<<"Error = "<<db.lastError().text();
}
And it all worked as expected. I could open the database, read from it, perform certain queries, but not after I used a VPN, I can no longer connect to the database.
I have tried to disconnect from the VPN but with no success I still cannot connect.
The error code is:
