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

# Query Database

The Query Database step allows you to run a query on a database. You can use variables in the query, meaning any part of your query can be dynamically adjusted.

![Read Website step](https://mintlify.s3-us-west-1.amazonaws.com/respell-docs-v2/_images/steps-reference/query-database.png)

We recommend being mindful of security considerations. While we encrypt your connection string and provide the option to enforce a read-only connection, exercise caution when running AI-generated or user-generated queries directly.

## Options

| Name              | Type       | Description                                                                                                                             |
| ----------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Connection String | Plain Text | The JDBC connection string to use to connect to the database. Must follow the format: `postgres://user:pass@123.45.67.89:5432/database` |
| Query             | Code       | The query you want to run on the database.                                                                                              |

## Outputs

| Name   | Type   | Description                                 |
| ------ | ------ | ------------------------------------------- |
| Result | Object | The response from the query in JSON format. |

## Tips

* If you're having trouble connecting to your database, double check that the connection string is correct by trying in another tool such as a database viewer (eg. DBeaver).
* If your database is behind a VPC or a service such as Bastion, reach out to the Respell team for information on how to connect to your database.
* We don't enforce a timeout, so be mindful of long-running queries that may degrade performance.
* If you'd like us to support other database types, reach out to the Respell team.
