Metabase Error Connecting to SQL Server 2016 on RHEL 9: A Tech Support Guide
When using Metabase, a popular data exploration tool, to connect to a SQL Server 2016 database on Red Hat Enterprise Linux (RHEL) 9, you might encounter an error. This guide aims to help you resolve the configuration issue.
Prerequisites
Before proceeding, ensure that:
- Your SQL Server 2016 is installed and configured on RHEL 9.
- The Metabase application is installed on your RHEL 9 system.
- You have the necessary permissions to configure the database connection.
Identifying the Issue
The error message you might encounter when connecting Metabase to the SQL Server 2016 database on RHEL 9 is:
com.microsoft.sqlserver.jdbc.SQLNonTransientConnectionException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "java.security.cert.CertificateException: No subject alternative names present
This error indicates that the Metabase application cannot establish a secure connection to the SQL Server 2016 database due to missing SSL certificate information.
Resolving the Issue
To resolve the issue, follow these steps:
Step 1: Update Java
First, update your Java installation to the latest version. On RHEL 9, you can use the following command:
sudo dnf update java-11-openjdk
Step 2: Configure the JVM
Next, configure the Java Virtual Machine (JVM) to trust the SSL certificate from your SQL Server 2016 database. Create a new file named truststore.jks in the /etc/metabase/ directory with the following content:
keyStoreType=JKS
keyStoreProvider=org.bouncycastle.jce.provider.BouncyCastleProvider
keyStore=file:/etc/metabase/truststore.jks
password=your_password
Replace your_password with a strong password. Then, update the Metabase configuration file located at /etc/metabase/metabase.conf by adding the following lines:
jvmArgs=-Djavax.net.ssl.trustStore=/etc/metabase/truststore.jks
jvmArgs=-Djavax.net.ssl.trustStorePassword=your_password
Testing the Connection
After completing the steps above, test the Metabase connection to the SQL Server 2016 database. If you still encounter issues, consider checking the Metabase logs located at /var/log/metabase/ for any error messages.
Summary and References
In this guide, we covered how to resolve the Metabase error connecting to a SQL Server 2016 database on RHEL 9 due to a missing SSL certificate. We updated the Java installation and configured the JVM to trust the SSL certificate from the database. For further reading, consider the following resources: