# Database Connector

## 🔃 What is the Database Connector ?

Using this connector we can connect our panel to any table with a primary key or any view available in any databases like SQL Server, Oracle, Postgres, MySQL or MariaDB.

{% hint style="info" %}
Using the database connector you could for example connect an existing customer table from your database to ngSurvey and then re-use the information you have about these customers within your surveys.
{% endhint %}

## ➕ Adding a Database connector

To add an ngSurvey connector you may click on the **New panel** button on the [panel management](/panels.md) screen and select either the **Database Table Connector** or the **Database View Connector**.

![](/files/-MC3MrjV7E4As9poIQ7I)

{% hint style="warning" %}
A primary key is required on the table you wish you to connect to and this primary key column will be automatically mapped to the source uid column of your panel.
{% endhint %}

## 🔅 Database connector properties

* **`Database connection string`** [connection string](https://www.connectionstrings.com/sql-server/) to your   database.
* **`Table to connect to the panel`** table of your database that will be used for your panel. Your table needs to have one primary key.
* **`Table columns to syncronize`** columns of your table that will be used as attributes.
* **`Sync mode`** whether or not the data synchronization of the table will be triggered manually from the [panel information box](/panels/panel-information.md) or automatically.
* **`Data sync type`** what changes from the table should be updated after the panel has been created and its data synchronized the first time.
  * **Add** will add new entries from the table to the panel.
  * **Update** will update any changes from the table to the panel.
  * **Delete** will delete any deleted row from the table to the panel.&#x20;
* **`Connector source update mode`** how the data updates within ngSurvey will propagate to the connected table.
  * **After approval** requires you to approve any changes done before these are getting pushed back to the table.
  * **Live link** updates immediately the table with any updates done on the ngSurvey side.
  * **Not allowed** no changes or updates will be pushed back to the SQL table.
* **`Source synchronization interval`**&#x6D;inutes after which the table will be synchronized again if the sync mode is set to Automatic.

## &#x20;[✅](https://emojipedia.org/check-mark-button/) **Supported Panel Connector Modes**

* **Read**   Allows to synchronize structure and data from a table or  View.
* **Update** Allows to [update existing data](/form-management/form-designer/questions/panel-linking/panel-updating.md) in the connected table.&#x20;

## ⚠️ **Known Limitations / Issues**

The database Connector has some limitations listed below.

* One primary key,  only table with a single primary key are supported at this time.
* Its not possible to add new columns for synchronizing once the panel has been created.

## 🔢 Supported SQL Server Types

Following SQL Server column types are currently supported for synchronization.

* bigint
* int
* smallint
* tinyint
* bit
* decimal
* numeric
* money
* smallmoney
* float
* real
* datetime
* smalldatetime
* char
* varchar
* text
* nchar
* nvarchar
* ntext


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ngsurvey.com/panels/panel-connectors/sql-server-connector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
