I am having a problem to connect to Sqlserver using a system dsn file.
The server is configured for windows and sql authentication, and I can access it without any problem with Management studio specifyng user ( sa) and pwd.
Now I am trying to execute a stored procedure in the server from excel vba. So I prepared a system dsn specifying all requested values (sql authentication using userid and password), and the connection test at the end of dsn definition works OK. However, if in the vba code I use
Code:
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset
cnn.Open ("DSN=Driver17Backup")
I get the error


If I use a "normal" connection string like this
Code:
connString = "Driver={ODBC Driver 18 for SQL Server};server=desktop-fmbj0fj\sqlexpress;database=RicevuteCPNCompletoBackup;" _
& "trustedConnection=No;encrypt=optional; uid=sa;pwd=xxxxxx; trustservercertificate=yes;"
cnn.Open connString
everything works without problems. Does this mean that the dsn file contains parameters other than those in the connection string? This seems strange.
An element that may help someone, but did not help me: If I run the code in the same machine where the server is, cnn.open (dsn=driver18Backup) works fine, so it looks like a network problem. But what is the problem, since management studio and the connection string work from a different machine?