MSOLEDBSQL driver is installed in my system. I am using the below syntax to connect to a database in a different SQL Server using OPENROWSET:
(in example I am trying to read from the same system)
SELECT c.*
FROM OPENROWSET(
'MSOLEDBSQL'
, 'Server=<Computer Name>;Database=<Database Name>;TrustServerCertificate=True;Authentication=ActiveDirectoryIntegrated;'
, 'SELECT * FROM [database name].[dbo].[table name];'
) c;
I am getting the below error:
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "Client unable to establish connection".
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "SSL Provider: The certificate chain was issued by an authority that is not trusted. ".
Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MSOLEDBSQL" for linked server "(null)".
Any kind of help is appreciated.
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "SSL Provider: The certificate chain was issued by an authority that is not trusted. "
This error can occur for a number of reasons, but the core is that (1) you are using encrypted communications, and (2) the certificate you are using does not meet the security criteria SQL Server requires. Likely, this was a local, self-issued certificate, which SQL Server is reluctant to trust, but more detail on the certs and settings would be needed.