As you have might guessed, if the server has "force encryption" set, the client cannot decline with "false".
The reason connection fails despite you have imported the certificate is that you are not connecting by the name that is in the certificate. The fact that the names must match is a security feature. Say that you are connecting to server GOODBOY, but someone has tampered with DNS and you are in fact connected to server EVILMAN and all sorts of bad things happens. This name check prevents this from happening.
Judging from the error message, there is no hostname in the certificate at all, so you will need to create a new one. I have found this article helpful for this process: https://codekabinett.com/rdumps.php?Lang=2&targetDoc=create-install-ssl-tls-certificate-sql-server
I should add that sometimes a server can go by multiple names, for instance just the server name or by FQDN. For this situation there is a connection-string option Host Name in Certificate
. (Note: I don't work with Java and JDBC, so the exact name may be different in your case.