Cant connect to MS SQL Server

0
When trying to connect to a MS SQL Server it returns error SQLState: 08S01.   "Opening JDBC connection to <database> 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: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:4e6b72bd-6290-4891-a3b2-cd864db9bcba", giving up..."   Attempted following to try to solve the issue: Following the Mendix guide to setup with MSSQL Making sure the database instance is running Enabling TCP/IP and setting the port to 1434 manually Opening port 1434 (the default port) Also tried port 1433 Different settings in the SQL Server (like compatibility modes) Both integrated security and not Running Mendix both normal and as Admin   Is there anything else I'm missing? Since most of these things seems to have solved similar problems for others. Thank you in advance!
asked
4 answers
2

Hi Christoffer,

 

As Marco mentioned 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.

 

database-config.JPG

 

 

answered
0

Hi Christofer,

 

Can you validate your connection string against this document:

https://learn.microsoft.com/en-us/sql/connect/jdbc/connecting-with-ssl-encryption?view=sql-server-ver16

 

Or, if unclear, post it in the comments without the actual uri or IP or anything that could reveal sensitive connection information.

 

Go Make It

answered
0

Thank you for the answer!

 

This is what I get with the different connection URLs:

 

temp.PNG

"Opening JDBC connection to localhost:1433/mendix_test_db 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: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:7e395ad4-9c08-44aa-992a-2310130f503c"

----

temp2.PNG

"Opening JDBC connection to jdbc:sqlserver://localhost:1433/mendix_test_db failed with SQLState: 08S01 Error code: 0 Message: "The TCP/IP connection to the host jdbc:sqlserver://localhost, port 1433 has failed. Error: "jdbc:sqlserver://localhost. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall."

----

 

answered
0

In Mendix 10.6 + this is enough (https://docs.mendix.com/refguide/custom-settings/)

 

Configuration/Custom

DatabaseUseSsl   false

 

image.png

 

if you use the custom JDBC the database is not always created.

answered