# Cannot connect to a database because of SSLHandshakeException

> **Warning:**
> Due to [Java security policy](https://java.com/en/jre-jdk-cryptoroadmap.html), TLS 1.0 and TLS 1.1 protocols [are disabled](https://datatracker.ietf.org/doc/rfc8996/) and considered insecure.

Due to [Java security policy](https://java.com/en/jre-jdk-cryptoroadmap.html), the usage of TLS 1.0 and TLS 1.1 protocols was disabled. This Java update caused the `javax.net.ssl.SSLHandshakeException` error that occurred when you tried to connect to old servers that still accept these protocols.

As a fix, you can explicitly enable these protocols. Note that it might result in vulnerability issues. Consider using newer versions of TLS.

## MySQL

Procedure:

1. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

2. Select a data source for which you want to enable disabled algorithms (for example, MySQL 8.0.3). The following required algorithms might be disabled: `SSLv3`, `TLSv1`, `TLSv1.1`, `RC4`, `DES`, `MD5withRSA`, `DH keySize < 1024`, `EC keySize < 224`, `3DES_EDE_CBC`, `anon`, `NULL`, `include jdk.disabled.namedCurves`.

3. In the right pane of a data source, click Test Connection.

4. In the notification, select an action that you want to perform. You can select among the following actions:

* Edit disabled algorithms: opens the Advanced tab of the selected data source and moves the focus to the VM options field. In the VM options field, you can edit a list of disabled algorithms manually (for the `Djdk.tls.disabledAlgorithms` option).

* Enable TLSv1: removes `TLSv1` from the `Djdk.tls.disabledAlgorithms` option. This action will enable TLS 1.0.

* Enable TLSv1.1: removes `TLSv1.1` from the `Djdk.tls.disabledAlgorithms` option. This action will enable TLS 1.1.

* Enable all protocols in JDBC driver: removes `SSLv3`, `TLSv1`, `TLSv1.1`, `RC4`, `DES`, `MD5withRSA`, `DH keySize < 1024`, `EC keySize < 224`, `3DES_EDE_CBC`, `anon`, `NULL`, `include jdk.disabled.namedCurves` from the `Djdk.tls.disabledAlgorithms` option. This action enables all the disabled algorithms.

5. Click Test Connection and see if the fix works.

You can try Enable TLSv1 and Enable TLSv1.1 first. If the error still occurs, try to enable other algorithms.

![javax.net.ssl.SSLHandshakeException](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_javax_net_ssl_ssl_handshake_exception.png)

## Microsoft SQL Server

Procedure:

1. In a file browser, create a `custom.java.security` file with the following contents:

```
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, \
     DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
     include jdk.disabled.namedCurves
```

Note that TLSv1 is removed from the list of disabled algorithms.

2. Open data source properties by doing one of the following:

* On the Database tool window toolbar, click ![The Data Sources icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.manageDataSources.svg) Data Sources.

* Press `Shift+Enter` (Windows), `⌘ I` (macOS), `⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Shift+Enter` (XWin), `Shift+Enter` (GNOME), `Shift+Enter` (KDE), `Shift+Enter` (Emacs), `Shift+Enter` (Sublime Text), `⌘ I` (Sublime Text (macOS)), `Shift+Enter` (NetBeans), `Shift+Enter` (Visual Studio), `⌘ I` (Visual Studio (macOS)), `Shift+Enter` (Eclipse), `⌘ I` (Eclipse (macOS)) .

![Open the Data Source and Drivers dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/open_data_sources_and_drivers_dialog.png)

3. Select your Microsoft SQL Server data source and click the Advanced tab and add the following option to the VM options field: `-Djava.security.properties=${PATH_TO_FILE?}/custom.java.security`, where `${PATH_TO_FILE?}` is a path to the created `custom.java.security` file.

4. In the main menu, go to `File | Invalidate Caches | Just restart`.

![the Just restart option in the Invalidate caches dialog](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_invalidate_caches_just_restart.png)

5. Try to connect to your Microsoft SQL Server data source.

![Path to the custom.java.security file in the Snowflake data source settings](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_driver_settngs_path_to_custom_java_security_file.png)

