---
title: Connect the database
project: OpenReports
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/openreports/1-0/guides/connect-database/
updated: 2026-11-19T07:46:42.257Z
---

# Connect the database

> Enter the PostgreSQL connection string and the name of the app in Configuration.

OpenReports reads its data from one PostgreSQL database. You set the connection in **Configuration**.

![The Application panel of Configuration with the Name and the Connection string](/files/JapUXO8qs61f.webp)

## Set the connection

1. Select **Configuration** (the gear icon) in the bar on the left.
2. In **Connection string**, enter the address of your database in this form: `postgres://user:password@host:5432/database`.
3. Select **SUBMIT**. The message **Configuration have been saved successfully.** appears.

OpenReports connects with the new settings straight away; you do not need to restart it. The field hides its value after you leave it.

## Name

**Name** is the name of the app. It appears as the title of the browser tab. The default is `OpenReports`.

## Use a user that can only read

The SQL of every view runs with the user of the connection string. Give OpenReports its own PostgreSQL user that can read your tables but not change them. For example, for a database named `shop`:

```sql
CREATE ROLE openreports LOGIN PASSWORD 'choose-a-password';
GRANT CONNECT ON DATABASE shop TO openreports;
GRANT USAGE ON SCHEMA public TO openreports;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO openreports;
```

Then use `openreports` and its password in the connection string. `GRANT SELECT ON ALL TABLES` covers the tables that exist now; run it again after you add tables.

## Other settings on this screen

- **Enable API for reading reports** and **Token**: see [Enable the API](../enable-api/).
- **OpenPlatform**: see [Use OpenReports with OpenPlatform](../openplatform/).
