3 months ago
Hello Railway Support Team,
I am having trouble connecting my Spring Boot application to PostgreSQL (postgres-oqtm) via the private network.
-- connection config
spring:
datasource:
url: jdbc:postgresql://${HOST}:{PORT}/${DB}
username: ${USER}
password: ${PASSWORD}
driver-class-name: org.postgresql.Driver
✅ Connection WORKS with: HOST and PORT from DATABASE_PUBLIC_URL
❌ Connection FAILS with: HOST=postgres-oqtm.railway.internal and PORT=5432
Error: PSQLException: The connection attempt failed.
Both services are in the same Railway project. Public connection works fine, but private network connection fails.
Questions:
1. Is postgres-oqtm.railway.internal:5432 the correct internal endpoint?
2. Any additional configuration needed for private network connectivity?
Thanks for your help.Attachments
8 Replies
3 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
Status changed to Awaiting Conductor Response ray-chen • 3 months ago
Railway
Hey there! We've found the following might help you get unblocked faster: - [🧵 PostgreSQL Private Network Unreachable After Upgrade to Pro Plan](https://station.railway.com/questions/postgre-sql-private-network-unreachable-a-bc53282c) - [🧵 Prisma deployment fails using internal Postgres URI](https://station.railway.com/questions/prisma-deployment-fails-using-internal-p-9a474cc7) - [🧵 Cannot connect to postgres database](https://station.railway.com/questions/cannot-connect-to-postgres-database-cbc3326f) If you find the answer from one of these, please let us know by solving the thread!
3 months ago
I've carefully reviewed the provided links/documentation, but unfortunately, I haven't found a solution to my specific issue.
3 months ago
Same issue for me :
Error: P1001: Can't reach database server at postgres.railway.internal:5432 Please make sure your database server is running at postgres.railway.internal:5432.
Any solution ?
Status changed to Awaiting User Response Railway • 3 months ago
medim
Hey, are you guys still having this issue?
3 months ago
Yes
3 months ago
Me and a friend (also a railway project) are having this same issue.
```
Datasource "db": PostgreSQL database "railway", schema "public" at "postgres.railway.internal:5432"
Error: P1001: Can't reach database server at postgres.railway.internal:5432
Please make sure your database server is running at postgres.railway.internal:5432.
```
Works fine from DATABASE_PUBLIC_URL. Fails from DATABASE_URL. I've been battling this for a week now. Even deleted and created a brand new project. The issue persists, I'm completely blocked from deploying. One of my existing railway projects works fine with the private DB URL.
Any newly created projects have issues. NextJS + Prisma.
3 months ago
Hi all, is there a solution we are facing the same issue. Sometimes it work sometime the connection and deployment fails. We debug our application and couldn't find any issues in our code. It looks to us that everything works fine when using the external url to connect.
3 months ago
Hello Railway Support Team,
I'm happy to report that the private network connection issue has been resolved in my case. My Spring Boot application can now successfully connect to PostgreSQL via postgres.railway.internal:5432.
Thank you for your assistance with this matter. I'm marking this ticket as solved.
Status changed to Solved slabuzov • 3 months ago