Database connection isssue The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption

Hello, I'm trying to connect a new app to a new database in the Mendix console, and I get this error.   Opening JDBC connection to failed with SQLState: 08S01 Error code: 0 Message: "The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: unable to find valid certification path to requested target". ClientConnectionId:0b32ed8f-e37a-45db-a440-f7174c0cd526", retrying...(1/4)   I also tried locally.
3 answers

Please try to use custom configuration under custom tab as I was also facing the same issue but with this configuration it started working for me.


Name: DatabaseJdbcUrl

Value: jdbc:sqlserver://localhost:1434;databaseName=MendixDB;integratedSecurity=false;encrypt=true;trustServerCertificate=true


It seems to be a bug in the MS SQL Server setup from Mendix for Mx 10. We also encountered this issue and could solve this by adding DatabaseUseSsl custom runtime setting and setting it to false. This setting is specifically for PostgreSQL, looking at the Mendix documentation, so really weird.. I guess by accident this setting also alters the MS SQL Server connection string whereas it shouldn't. We have logged a ticket at Mendix for this.


EDIT 2-4-2024: It is not a bug but a new feature.

Directly from the reply by Mendix:


As mentioned in the release notes of Mendix 10, we upgraded the SQL Server JDBC driver to version 12.2.0. Since version 10, the driver uses TLS encryption by default. You can turn off encryption by setting DatabaseUseSsl to false or by setting encrypt=false in DatabaseJdbcUrl. The alternative would be to make sure the server has a trusted certificate or configure the runtime to trust the server certificate.


Hi Mohamed,


Can you validate your connection string against this document:


You can add an custom configuration to your SQL Server database configuration. 

Name: DatabaseJdbcUrl

Value: jdbc:sqlserver://localhost:1433;databaseName=DatabaseName;integratedSecurity=true;encrypt=true;trustServerCertificate=true;

With this setting Microsoft JDBC Driver for SQL Server won't validate the SQL Server TLS certificate.




Go Make It