> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.squarecloud.app/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# DBeaver: how to connect to PostgreSQL (SSL)

# DBeaver: How to Connect to PostgreSQL

DBeaver allows you to intuitively manage your tables, execute complex queries, and visualize data from your PostgreSQL database hosted on Square Cloud. To establish this connection securely, we will use encryption certificates (SSL).

---

## 1. Connection Details

Before opening DBeaver, locate the connection URL in your dashboard. You will need to extract the following information:

* **Host:** square-cloud-db-id.squareweb.app (`id` is your instance ID, which is already included in the copied URL).
* **Port:** The provided numerical port (e.g., 31000).
* **Database:** `squarecloud` (or the name of the database you created).
* **Username:** `squarecloud`
* **Password:** The password generated along with the instance.

---

## 2. Configuring the Connection in DBeaver

1. Open DBeaver and click the **New Database Connection** icon (a plug with a plus sign).
2. Select **PostgreSQL** and click "Next".
3. In the **Main** tab, fill in the fields with the data collected in the previous step (Host, Port, Database, Username, and Password).

---

## 3. Configuring SSL (Mandatory Step)

Square Cloud does not allow connections without SSL for PostgreSQL. To configure it, follow this path within the connection window:

1. Go to the **SSL** tab.
2. Check the **Use SSL** box.
3. In the **SSL Mode** field, select `verify-ca` or `require`.
4. Now, point to the files you downloaded from the dashboard:
    * **Root Certificate:** Select the `.crt` file.
    * **SSL Certificate:** Select the **same** `.crt` file.
    * **SSL Key:** Select the `.key` file.

---

## 4. Testing the Connection

After configuring SSL, click the **Test Connection** button in the bottom left corner.

* **If "Connected" appears:** Congratulations! You can now manage your database.
* **If an "SSL" error occurs:** Make sure that the `.key` and `.crt` files are in the correct fields and that the SSL mode is not set to "disable".

---

**Pro Tip:** In DBeaver, you can save these configurations in different "Projects" to quickly switch between your production and development databases.