I did some searches and I was missing some configuration steps that I never had the need to do when using Lazarus.
Ok...so I've installed everything related to "freetds" and "unixodbc".
Configured "/etc/freetds.conf" as follows:
[SQLSRV]
host=192.168.1.205
port=1433
tds version=7.4
instance=CASA
then checked the connection from the commandline with:
tsql -S SQLSRV -U sa
it asked the password, typed the password but the connection failed telling:
Error 20012 (severity 2):
Server name not found in configuration files.
locale is "it_IT.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Error 20013 (severity 2):
Unknown host machine name.
Error 20009 (severity 9):
Unable to connect: Adaptive Server is unavailable or does not exist
There was a problem connecting to the server
I found a post where an user suggested to "cp /etc/freetds.conf ~/.freetds.conf" (<-- this last operation is needed only to make "tsql ....." connecting without errors, it's not needed for Qt to work as I discovered later)
Ok...I tried to go on and configured "/etc/odbcinst.ini" as follows:
[FreeTDS]
Description=FreeTDS unixODBC Driver
Driver = /usr/lib/arm-linux-gnueabihf/odbc/libtdsodbc.so
and "/etc/odbc.ini":
[P860]
Description= SQL Server
Driver= /usr/lib/arm-linux-gnueabihf/odbc/libtdsodbc.so
Trace= No
Server= 192.168.1.205\CASA
Port= 1433
TDS_Version= 7.4
then I checked the connection with:
isql P860 sa 12345
and this time it connected and I was able to execute queries.
I went back to the code and modified this way:
QString cnStr = QStringLiteral("P860");
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName(cnStr);
bool ok = db.open("sa", "12345");
...and now it can connect to SQL Server !
Thanks for the support !
Roberto