---
title: PostgreSQL SSL Integration Guide
slug: litmusedge-v1/how-to-guides/integration-guides/postgresql-ssl
description: Learn how to set up the PostgreSQL with SSL connector. 
docTags: 
createdAt: 2024-01-17T13:53:34.991Z
---

Review the following guide for setting up an integration between Litmus Edge and a PostgreSQL database using SSL authentication.&#x20;

# Before You Begin

You will need the following:

- Access to a PostgreSQL database that uses SSL authentication.
- The CA Certificate and any other required authentication parameters to access the database.&#x20;

Refer to the following links to learn more:

- [PostgreSQL Docker Image](https://hub.docker.com/_/postgres)
- [PostgreSQL Documentation](https://www.postgresql.org/docs/)
- [Secure TCP/IP Connections with SSL](https://www.postgresql.org/docs/16/ssl-tcp.html)

# Step 1: Add Device

Follow the steps to [Connect a Device](docId:3eyAfPpweuVmBLCEy17sq). The device will be used to store tags that will be eventually used to create outbound topics in the connector. Make sure to select the **Enable Data Store** checkbox.&#x20;

# Step 2: Add Tags

After connecting the device in Litmus Edge, you can [Add Tags](docId:8sE7z3PmRfwL1nmzcwaLX) to the device. Create tags that you want to use to create outbound topics for the connector.&#x20;

# Step 3: Add the DB - PostgreSQL SSL Connector

Follow the steps to [Add a Connector](docId\:b7eMDh8AO2-NOqDHwPD7Y) and select the **DB - PostgreSQL SSL&#x20;**&#x70;rovider.&#x20;

Configure the following parameters.&#x20;

- **Name**: Enter a name for the connector.&#x20;
- **Hostname**: Enter the hostname for the PostgreSQL database.&#x20;
- **Port**: The PostgreSQL Server port. The default value is **5432**.&#x20;
- **SSL Mode**: Select the SSL Mode (require, verify-ca, verify-full).&#x20;
- **CA Certificate**: Paste the CA certificate associated with the database. For Litmus Edge version 3.11.0 and later, you have the option to upload the certificate.&#x20;
- **Certificate**: Paste the SSL certificate. For Litmus Edge version 3.11.0 and later, you have the option to upload the certificate.&#x20;
- **Private Key**: Enter or paste the SSL private key.&#x20;
- **Username**: Enter the appropriate username.&#x20;
- **Password**: Enter the password for the username. &#x20;
- **Database**: Enter the database name.&#x20;
- **Table**: Enter the table name.
- **Show Mapping**: If you want to send data to a custom table, select this check box and unselect *Create table*. See [Work with Tables in SQL Connectors (Create Table and Show Mapping)](docId\:Yj_sKBPP9J_TH3_qvC1Tm) to learn more. To add key/value pairs for the custom table, see [Configure Key/Value Pairs](docId\:Yj_sKBPP9J_TH3_qvC1Tm).&#x20;
- **Create table**: If you want to send data to an existing table in the default format, or you want to create a new table in the default format, select this checkbox and unselect *Show Mapping*. See [Work with Tables in SQL Connectors (Create Table and Show Mapping)](docId\:Yj_sKBPP9J_TH3_qvC1Tm) to learn more.&#x20;
- **Commit timeout**: Enter the transaction commit timeout in (ms).
- **Max transaction size**: Enter the maximum number of messages before a transaction is committed, regardless of timeout parameter.&#x20;
- **Bulk insert count**: (Available for Litmus Edge version 3.11.1 and later) To enable this option, enter the number of messages to group together and send as one bulk insert statement. Enabling this option can improve how quickly data is processed when dealing with high volumes of tags.&#x20;
- **Throttling limit**: The maximum number of messages per second to be processed. The default value is zero, which means that there is no limit.&#x20;
- **Persistent storage**: When enabled, this will cause messages to undergo a store-and-forward procedure. Messages will be stored within Litmus Edge when cloud providers are online. &#x20;
- **Queue Mode**: Select the queue mode as **lifo&#x20;**(last in first out) or **fifo&#x20;**(first in first out). Selecting **lifo&#x20;**&#x6D;eans that the last data entry is processed first, and selecting **fifo&#x20;**&#x6D;eans the first data entry is processed first.&#x20;

# Step 4: Enable the Connector

After adding the connector, click the toggle in the connector tile to enable it.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/iMtx0yTin43zijwoyX-k0_postgressl.png" size="60" width="388" height="358" position="center" showCaption="false"}

If you see a *Failed&#x20;*&#x73;tatus, you can review the [Connector Logs](docId:5hctoRLhgaX3Ikh_lvi0A) and relevant error messages.&#x20;

# Step 5: Create Topics for Connector

You will now need to import the tags created in Step 2 as topics for the PostgreSQL connector. The topics will be created as outbound topics.&#x20;

**To create outbound topics:**

1. Click the connector tile.
   The connector *Dashboard&#x20;*&#x61;ppears.&#x20;
2. Click the **Topics&#x20;**&#x74;ab.&#x20;
3. Click the **Import from DeviceHub** tags icon.&#x20;
   The *DeviceHub Import&#x20;*&#x64;ialog box appears.

![](https://api.archbee.com/api/optimize/xSuIWwMa6RnsbeD5Kdqd7-zaOGMDYbPZWYALvLBgotp-20250606-203859.png)

After adding all required topics, navigate to the Integration overview page and ensure the connector is not disabled and still shows a CONNECTED status.&#x20;

# Step 6: Enable Topics

Ensure the topics you imported are enabled by returning to the *Topics&#x20;*&#x74;ab and clicking the **Enable all topics** icon.&#x20;

![](https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/HtkW-nbWXeAvOV8ru8B1U_image.png)

# Step 7: Make PostgreSQL Queries

You can now verify that you can view data in the PostgreSQL database.&#x20;

Update the credentials, database name, and table name to your specific configurations.&#x20;

**To make PostgreSQL queries:**

1. From the PostgreSQL terminal window, enter `psql -h locahost -U postgres`**&#xA0;**&#x61;nd press **ENTER**. If you configured a different username, replace `postgres`.&#x20;
   The *psql (9.6.5)***&#xA0;**&#x76;ersion number appears.
2. Enter `\l`**&#xA0;**&#x61;nd press **ENTER**.
   The list of databases appears in the console.
3. Enter `\c postgres`**&#xA0;**&#x61;nd press **ENTER**.&#x20;
   *You are now connected to database "db-example" as user "postgres"* appears.
4. Enter `\dt` and press **ENTER**.
   The list of relations appears showing the devicehub schema.
5. Enter `\d devicehub` and press **ENTER**.
   The *public.devicehub* table appears.
6. Enter `select * from devicehub;` and press **ENTER**.
   The data for the devicehub table appears.

