I'm trying to make a connection to a remote SQL
server :
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC3");
db.setDatabaseName(QString("Driver={SQL Server Native Client 10.0};Server=X.X.X.X;Database=/*DB*/;"));
db.setUserName("sa");
db.setPassword("/*password*/");
if (!db.open()) {
qDebug() << db.lastError().text();
}
else
{
qDebug() << "connected";
}
But after about 7 sec it gives me this log :
[Microsoft][SQL Server Native Client 10.0]Named Pipes Provider: Could not open a connection to SQL Server [1326]. [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [Microsoft][SQL Server Native Client 10.0]Login timeout expired QODBC3: Unable to connect
However server is up and running and the connectivity is ok and already tested with UDL
file.
Note: the local connection works well