I have a Java project running in IDX with a PostgreSQL database. I’m able to access everything perfectly from my Angular application that is in a different IDX workspace. I have made both the Java and the PostgreSQL ports public from the Java project, but I cannot seem to access the database using PGAdmin running locally on my laptop. I keep getting a connection timeout error like it can’t find the server. I’m copying the URL from IDX and using port 5432. Any ideas are appreciated. TIA
Hey Philip,
I think IDX only exposes/forwards HTTP/HTTPS traffic, not PostgreSQL protocol.
So if your intention is just to view or manipulate data, it’s better if you use a web interface there. Try this:
Run in the same workspace as your PostgreSQL database
docker run -d -p 0.0.0.0:8081:8081 --name pgweb \ -e DATABASE_URL="postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable" \ sosedoff/pgweb
Make sure they are in the same network.
Then access your database through https://8081-idx-test-env-[...].cloudworkstations.dev
This works because the web client talks to PostgreSQL locally within the workspace, then serves it as HTTP which can pass through IDX’s public URL system to your browser.
But if you are planning on using this DB locally in a project then I don’t have any idea for this.