---
title: "Select PDC and test connection | Grafana Labs"
description: "Learn how to select a private data source connection and test the PostgreSQL database connection."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Select PDC and test connection

The private data source connect (PDC) feature lets you establish a secure connection between Grafana Cloud and a PostgreSQL database on a private network.

Grafana Cloud can’t reach databases on `localhost`, `127.0.0.1`, or private IP ranges (`10.x`, `172.16.x`, `192.168.x`) directly. If your database isn’t publicly accessible, PDC creates a secure tunnel so the connection can succeed.

**Recommendation:** If your PostgreSQL database isn’t publicly accessible, use PDC to establish a secure connection. If your database is publicly reachable, you can skip the PDC selection in the next step.

1. In the **Private data source connect** field, select the name of a PDC agent.
   
   **Note:** For the test connection to succeed, you must select a PDC agent that’s running. Skip this step if your database is publicly accessible.
2. Click **Save &amp; test**.
   
   When successful, you’ll see the message: `Database Connection OK`. Grafana also auto-detects your PostgreSQL server version on save.

In the next milestone, you’ll verify that your PostgreSQL data appears correctly in Grafana Cloud.

* * *

### More to explore (optional)

- [TLS and certificate errors](/docs/grafana/latest/datasources/postgres/troubleshooting/#tls-and-certificate-errors)
- [Grafana alerting with PostgreSQL data](/docs/grafana/latest/datasources/postgres/alerting/)

Were you successful?

![No](/media/images/svg/thumbs-up.svg) No

![Yes](/media/images/svg/thumbs-up.svg) Yes

Super! You can move to the next step.

* * *

### Troubleshooting

Explore the following troubleshooting topics if you need help:

- [Failed to connect to PostgreSQL](/docs/grafana/latest/datasources/postgres/troubleshooting/#failed-to-connect-to-postgresql)
- [Grafana Cloud can’t reach a private database](/docs/grafana/latest/datasources/postgres/troubleshooting/#grafana-cloud-cant-reach-a-private-database)
- [Password authentication failed](/docs/grafana/latest/datasources/postgres/troubleshooting/#password-authentication-failed)

Please tell us what didn't work:

Submit

Submitting...

There was an error with your submission.

Thank you!

Need more support? Check out these [helpful resources.](/help/)
