The following error might occur when attempting to use a SQL or Database connection object in some way that connects to SQL Server:
Another variation of this error could be:
U02012064 'encrypt' property is set to 'true' and 'trustServerCertificate' property is set to 'false' but the driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption: Error: PKIX path building failed: sun.securi..
SQL Server of a certain version requires TrustServerCertificate=true for the connection properties. This can be set on the connection object by:
Now the connection object will test successfully to the database
PLEASE NOTE
Using the TrustServerCertificate does require the use of a connection object. If it's mandatory to NOT use connection objects on database jobs, it might be possible to use a very old sql server jdbc jar file (like jdbc 6.4) and bypass the need to have the TrustServerCertificate property
MS article on this: https://techcommunity.microsoft.com/t5/azure-database-support-blog/pkix-path-building-failed-unable-to-find-valid-certification/ba-p/2591304