> ## Documentation Index
> Fetch the complete documentation index at: https://docs.softr.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SQL Database

> Connect your PostgreSQL, MySQL, SQL Server and MariaDB databases to Softr apps.

In Softr, you can easily build powerful, data-driven applications by using **PostgreSQL, MySQL, SQL Server, and MariaDB** as data sources.

With SQL data sources, you can:

* Integrate your structured data into **custom apps and dashboards**

* Enable **secure access** for internal teams and external partners

* Scale without hitting **record limitations**

<Info>SQL data sources is available on Business and Enterprise plans.</Info>

## **1. Connect your SQL database to Softr**

To use the SQL database in Softr, you must first **link your account**. Before connecting, make sure you have:

* Access to your **SQL database credentials** (hostname, database name, username, and password).

* Necessary **permissions to access and modify** the database.

<Steps>
  <Step title="Open Data Sources in Softr">
    1. Log in to Softr and go to [Data Sources](https://studio.softr.io/dashboard/data-sources) in the left-hand menu.

    2. Click **Connect Data Source**.
           <Frame caption="Add, edit, or remove a datasource using the buttons on the dashboard">
             <img src="https://mintcdn.com/softr-2b8a27e1/wZsu0rPwV3m7R1-j/data-sources/images/sql-database/image1.png?fit=max&auto=format&n=wZsu0rPwV3m7R1-j&q=85&s=4f848232f91cde78bab0631b418ec435" alt="Add, edit, or remove a datasource using the buttons on the dashboard" width="2551" height="1264" data-path="data-sources/images/sql-database/image1.png" />
           </Frame>
  </Step>

  <Step title="Select your SQL database">
    Choose one of the following supported databases:

    * **PostgreSQL**

    * **MySQL**

    * **SQL Server**

    * **MariaDB**
  </Step>

  <Step title="Enter your database credentials">
    After selecting your database type, enter the following credentials:

    * **Host** – The database server address (e.g., `db.example.com`)

    * **Port** – Default ports: `5432` (PostgreSQL), `3306` (MySQL & MariaDB), `1433` (SQL Server)

    * **Database Name** – The name of your database

    * **User** – Your database username

    * **Password** – Your database password
          <Frame>
            <img src="https://mintcdn.com/softr-2b8a27e1/wZsu0rPwV3m7R1-j/data-sources/images/sql-database/image2.png?fit=max&auto=format&n=wZsu0rPwV3m7R1-j&q=85&s=58be8f1ba6f79c12197af460bcc239bf" alt="Notion image" width="2428" height="1450" data-path="data-sources/images/sql-database/image2.png" />
          </Frame>
  </Step>

  <Step title="Confirm your setup">
    Click **Connect** to verify and establish the connection. If the connection fails, double-check your credentials and try again.
  </Step>
</Steps>

## **2. Connect your SQL data to your Softr app**

Once your SQL account is connected, you can use it in any Softr application.

<Steps>
  <Step title="Connect your data to a dynamic block">
    To display your data in the app, connect a [dynamic block](/core-concepts-overview/c5VwEbsWtTfPyUZjmEKvfx/visualize-data-with-building-blocks/41p6U2eZs7zgY8zWmFV4eH#1859a723d691803d9551ecd7b3b0c043) (e.g. [List](/building-blocks/vikC2AWEpQGkZd4jGyoVxo/list-block/pQhPYuA28VXr5tLLFBcbCU), [Grid](/building-blocks/vikC2AWEpQGkZd4jGyoVxo/grid-block/42JZoeYwMsogZcveqh74QH), [Table](/building-blocks/vikC2AWEpQGkZd4jGyoVxo/table-block-/j7rGwu7J7zuU69h3bZ7HFe)) to your SQL table:

    1. Go to the Block **source** **tab** and select your SQL integration.

    2. Select the **database** you want to connect.

    3. Pick the **table** you want to use or **add a new** **query**

    4. Optionally, select the **primary field**.<br />
           <Frame caption="Connect your data to a dynamic block">
             <img src="https://mintcdn.com/softr-2b8a27e1/wZsu0rPwV3m7R1-j/data-sources/images/sql-database/image3.png?fit=max&auto=format&n=wZsu0rPwV3m7R1-j&q=85&s=2d89a01630d95908bb33cf4610b7f464" alt="Connect your data to a dynamic block" width="2658" height="1302" data-path="data-sources/images/sql-database/image3.png" />
           </Frame>
  </Step>

  <Step title="Map Fields">
    When you connect your table to a block, you can choose which table **properties** to display and map to Softr fields. This lets you control how your data appears in Softr.

    **Example:** If you have an **email field** in the SQL database, select **an email field** in Softr.

    <Frame caption="Map SQL fields">
      <img src="https://mintcdn.com/softr-2b8a27e1/wZsu0rPwV3m7R1-j/data-sources/images/sql-database/image4.png?fit=max&auto=format&n=wZsu0rPwV3m7R1-j&q=85&s=66ece087a9c6febf23585f4a8ea31257" alt="Map SQL fields" width="2658" height="1334" data-path="data-sources/images/sql-database/image4.png" />
    </Frame>
  </Step>
</Steps>

### **Restricting IP Access**

If needed, add Softr’s IPs to your database’s **allowed list**:

* `3.120.79.212`

* `3.123.159.186`

* `52.58.246.121`

## **FAQs**

<AccordionGroup>
  <Accordion title="Can I update my SQL database from Softr?">
    Yes! You can create forms in Softr that **write data back** to your SQL database.
  </Accordion>

  <Accordion title="Is my SQL data secure?">
    Absolutely! Softr uses **industry-standard encryption** to protect your data.
  </Accordion>

  <Accordion title="Can I connect multiple databases to one Softr app?">
    Yes! You can connect **multiple SQL databases** and use them within the same app.
  </Accordion>
</AccordionGroup>

March 7, 2025
