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

# Database connector

# Database Connector

The Database Connector allows you to securely connect a shared database to a **Project**, making its data available to all project members through chat.

> **Important change**: Database connectors are no longer added directly inside a chat. They are now **project-level shared connectors**, managed from the Project sidebar.

<Warning>
  Ask your IT administrator to enable the Database Connector in your system configuration [with the Operator Manual](/en/operator-manual/configuration/features).
</Warning>

***

## Creating a Database Connector

To create a database connector:

1. Open your **Project Sidebar**
2. Click **Connectors**
3. Click **Create connector**
4. Select **Database**
5. Enter the required **connection details**
6. Establish the connection

Once the connection is successful, additional configuration options become available.

<iframe width="560" height="315" src="https://www.youtube.com/embed/uTQ07GFxffk" title="Zylon Workspace - Creating Database Server Connector" style={{ borderRadius: "12px" }} frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

***

### Connection strings made simple

A connection string is like an address that tells the system where to find your database and how to access it. Your IT team can help you build the right connection string for your database.

#### Supported database types

* Microsoft SQL Server
* PostgreSQL
* MySQL
* DB2

#### Connection string

<Warning>
  **Security Notes**:

  * Never share your connection strings with others
  * Use only the databases your IT team has approved
  * Make sure the user is read-only
</Warning>

Here's what each part means (ask your IT team for the correct values):

```
SQL Server: mssql+pyodbc://username:password@server:1433/database
PostgreSQL: postgresql://username:password@server:5432/database
MySQL: mysql+mysqldb://username:password@server:3306/database
DB2: db2+ibm_db://username:password@server:50000/database
```

**Examples**

<CodeGroup>
  ```sql Microsoft SQL Server theme={null}
  mssql+pyodbc://sa:password123@server.company.com:1433/SalesDatabase

  mssql+pyodbc://dbuser:mypassword@192.168.1.50:1433/CustomerData

  mssql+pyodbc://localhost:1433/TestDB?TrustServerCertificate=yes
  ```

  ```sql PostgreSQL theme={null}
  postgresql://postgres:admin123@database.company.com:5432/company_data

  postgresql://user:password@10.0.0.25:5432/sales_db

  postgresql://localhost:5432/public_data
  ```

  ```sql MySQL theme={null}
  mysql+mysqldb://root:password@mysql.company.com:3306/customer_info

  mysql+mysqldb://appuser:secret123@127.0.0.1:3306/inventory

  mysql+mysqldb://localhost:3306/reports
  ```

  ```sql DB2 theme={null}
  db2+ibm_db://db2admin:password123@db2server.company.com:50000/SALESDB

  db2+ibm_db://dbuser:mypassword@192.168.1.50:50000/PRODDATA

  db2+ibm_db://localhost:50000/TESTDB
  ```

  Remember: Replace `username`, `password`, `server`, and `database` with your actual values.
</CodeGroup>

## Advanced Configuration

After the database connection has been established, you can configure advanced parameters to control how the database is used.

### Table and Schema Restrictions

You can limit the connector’s access to:

* Specific **schemas**
* Specific **tables**

This helps:

* Reduce unnecessary data exposure
* Improve query accuracy
* Prevent the LLM from querying irrelevant data

### Connector Description

You can define a **description** for the database connector.
This description is provided to the LLM and should explain:

* What the database contains
* How the data is structured
* Any important rules or conventions

A good description significantly improves the quality of queries generated by the LLM.

***

## Using the Database Connector in Chat

Once created, the database connector can be used in chats:

1. Open or create a chat within the project
2. Use the **Connectors selector** in the chat input
3. Enable the database connector

When enabled, the LLM can query the database as part of the conversation.

<iframe width="560" height="315" src="https://www.youtube.com/embed/e6W6fUodUQM" title="Zylon Workspace - Using connectors" style={{ borderRadius: "12px" }} frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

***

## Pre-Selected Connectors

Project administrators can configure database connectors to be **pre-selected for every new chat** in the project.

This is especially useful when:

* The database is a core part of the project workflow
* Non-technical users need access to MCPs or databases without having to deal with complex configuration
* Consistent data access is required across all conversations

***

## Personal and Private Usage

If a user wants to configure their **own database connectors** without sharing them:

1. Create a **private project**
2. Create database connectors using the same process
3. Use them exclusively within that private project

Private projects allow experimentation or personal integrations without affecting shared environments.

***

## Requirements and Considerations

* The database must be reachable from the connector environment
* Network access, firewalls, and IP allowlists may need configuration
* Queries generated by the LLM respect the connector’s configured scope

***

## Security

* Credentials are stored securely
* The LLM can only access data allowed by the connector configuration
* Schema and table restrictions are enforced at query time

***

## Database connectivity troubleshooting

If your database connector hangs indefinitely or times out, verify network connectivity from the machine where Zylon is installed.

### Test the connection

Run this command from the machine where Zylon is installed:

```bash theme={null}
curl -v telnet://your-db-host:port
```

### Interpret results

**Successful connection:**

```
* Connected to your-db-host (xxx.xxx.xxx.xxx) port xxxx
```

Network connectivity is working correctly. If issues persist, contact support.

**Connection timeout:**

```
* Failed to connect to your-db-host port xxxx: Operation timed out
```

Network problem detected. Check firewall rules, security groups, and IP allowlists.

**Connection refused:**

```
* Connection refused
```

The database server is not listening on that port. Verify the database is running and configured to accept external connections.

### Common causes

* Firewall blocking outbound traffic from the Zylon host
* Security groups / ACLs blocking the database port
* Incorrect hostname or port
* Database not accepting connections from Zylon's IP
