The following error might occur when attempting to use a SQL or Database connection object in some way that connects to SQL Server:
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