Connection difference between MSOLEDBSQL 18.x and 19

Due to a change in Microsoft OLE DB Driver 19 from Microsoft OLE DB Driver 18, you may fail to connect to the database. Please refer to the following about the change and the possible solution.

With the following combination of settings:

  • {base_registry_key}\Flag1 being the default 0 ({base_registry_key}: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\SNI{major_version}.0\GeneralFlags);

  • {base_registry_key}\Flag2 being the default 0;

  • The "Encrypt Data" option in the DB profile being checked;

  • The "Trust Server Certificate" option in the DB profile being checked

If you use Microsoft OLE DB Driver 19, encryption occurs only if there's a verifiable server certificate, otherwise the connection attempt fails. If you use Microsoft OLE DB Driver 18, encryption always occurs, but may use a self-signed server certificate.

Therefore, if you have checked the "Encrypt Data" and "Trust Server Certificate" options in the DB profile, please take any of the following solutions to ensure the encryption will correctly in Microsoft OLE DB Driver 19:

  1. Change the {base_registry_key}\Flag2 to 1, or,

  2. Provide a verifiable server certificate.