> For the complete documentation index, see [llms.txt](https://docs.docbits.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docbits.com/advanced-functions-and-tools/powerbi/connect-via-read-only-database.md). Agents can also search and read this documentation through its [MCP server](https://docs.docbits.com/~gitbook/mcp).

# Connect via Read-Only Database

This guide walks you through connecting **DocBits’ Read-Only Database to Power BI Desktop** using the **PostgreSQL ODBC driver**. It covers driver installation, ODBC configuration, Power BI integration, and scheduled refresh.

{% embed url="<https://youtu.be/O1MtuXf_R_M>" %}

#### 1. Install the PostgreSQL ODBC Driver

* Download the latest PostgreSQL ODBC driver (**psqlODBC**) from the official site:
  * <https://www.postgresql.org/ftp/odbc/releases/>
* Run the installer and follow the setup wizard.

#### 2. Configure the ODBC Data Source

* Open **ODBC Data Source Administrator (64-bit)** via Control Panel or Windows Search.
* Go to the **System DSN** tab and click **Add**.
* Select **PostgreSQL Unicode(x64)** driver from the list and click **Finish**.
* Fill in the required fields with credentials from:\n **DocBits → Settings → Document Processing → Module → AI Dashboard → Read-Only DB Access**

<figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-1ae4c197eaf00269f81f21dd4eba8a537883aeee%2Fconnect_read_only_4.png?alt=media" alt="DocBits Database Access settings with DB Access enabled, credential fields for username, password, database, host and port, and a list of available tables"><figcaption></figcaption></figure>

**Required Fields:**

* **Name:** A name for the connection (e.g., `Sandbox-Read_Only`)
* **Server:** Copy the host value from DocBits
* **Port:** Copy the port value from DocBits
* **Database:** Copy the database name from DocBits
* **Username:** Copy the username from DocBits
* **Password:** Copy the password from DocBits
* **SSL Mode:** Set to **Require** (ensures encrypted communication)

#### 3. Connect Read-Only DB to Power BI

* Open **Power BI Desktop**.
* Select **Get Data** → **ODBC** → **Connect**.

  <figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-2df574ab7d5cc13b422d6bb0c4d92ffdb0ca334d%2Fpowerbi_get_data_odbc.png?alt=media" alt="Power BI Get Data ODBC"><figcaption></figcaption></figure>
* From the DSN list, select your configured source (e.g., `Sandbox-Read_Only`).

<figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-3a675e1a3c179dd8adfebc36fed5ee7e8463d2ba%2Fconnect_read_only_3.png?alt=media" alt="Power BI From ODBC dialog with the data source name Sandbox-Read_Only selected and the OK button"><figcaption></figcaption></figure>

* Click **OK**. Enter credentials again if prompted.
  * If `password authentication failed for user` appears, verify the host, database, username and password. Enter the actual password in the credential dialog. Curly-brace escaping in an ODBC connection string is driver syntax; it is not a general fix for failed authentication.

#### 4. Load and Transform Data

* In the **Navigator** pane, expand the schema list.
* Open the **`public`** schema.
* Select the tables you want to import.

![Power BI Navigator listing the public schema tables of the sandbox-doc2api database with no items selected for preview](https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-d9da40801794e260ea47cac0838dd469e1269bd1%2Fconnect_read_only_1.png?alt=media)

![Power BI Navigator with the task table checked and its data previewed, with Load and Transform Data buttons](https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-8f99c506f8a97119aa800ed841b89dfec3dcebc6%2Fconnect_read_only_2.png?alt=media)

* Choose:
  * **Load** → Import directly into Power BI
  * **Transform Data** → Open Power Query for shaping and filtering before loading

#### 5. Visualize Your Data

* Use the Power BI report canvas to build dashboards.
* Drag fields, add slicers, choose chart types, and apply DAX calculations.
* Use **Power Query Editor** to clean or join data before creating visuals.
* Reference: [Power BI Documentation](https://learn.microsoft.com/en-us/power-bi/)

#### 6. Enable Scheduled Refresh (Optional)

Scheduled refresh depends on the workspace license/capacity, connector and connection mode. For this ODBC connection, configure a reachable gateway with the appropriate driver, DSN and credentials; check the current requirements in the official documentation.

* To keep your reports in sync with PostgreSQL:
* Publish your `.pbix` file to **Power BI Service**.
* Install the **Power BI Gateway** (Standard mode) on a machine with network access to PostgreSQL.
* In Power BI Service:
  * Open the semantic model → **Refresh** → **Schedule refresh** (the location can differ in older versions)
  * Map your DSN and provide credentials
* More informations [here](https://learn.microsoft.com/en-us/power-bi/connect-data/service-gateway-deployment-guidance).

#### 7. Example Dashboards & Data Views

<div><figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-e9d42f908877f27b20b7fef6aabcefc2a62ee612%2Fpowerbi_dashboard_example_1.png?alt=media" alt="Power BI Dashboard Example 1"><figcaption></figcaption></figure> <figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-76245fedbfc1c38d4fd16788c385f6555ef9c3e8%2Fpowerbi_dashboard_example_2.png?alt=media" alt="Power BI Dashboard Example 2"><figcaption></figcaption></figure> <figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-fbe836770a7c4c8c3eb506b0411a7be9a7c0bb8c%2Fpowerbi_dashboard_example_3.png?alt=media" alt="Power BI Dashboard Example 3"><figcaption></figcaption></figure> <figure><img src="https://578966019-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2n2w4uDCJvv7CJ5zrdk%2Fuploads%2Fgit-blob-66bc278fabf8217eea1c56aac2e11c91bea5cb66%2Fpowerbi_dashboard_example_4.png?alt=media" alt="Power BI Dashboard Example 4"><figcaption></figcaption></figure></div>

[Official documentation — ODBC](https://learn.microsoft.com/en-us/power-query/connectors/odbc)

[Official documentation — psqlODBC](https://odbc.postgresql.org/docs/config-opt.html)

[Official documentation — Power BI](https://learn.microsoft.com/en-us/power-bi/connect-data/refresh-scheduled-refresh)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.docbits.com/advanced-functions-and-tools/powerbi/connect-via-read-only-database.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
