This is the error.
[CANNOT_ESTABLISH_CONNECTION] Cannot establish connection to remote POSTGRESQL database. Please check connection information and credentials e.g. host, port, user and password options. ** If you believe the information is correct, please check your workspace's network setup and ensure it does not have outbound restrictions to the host. Please also check that the host does not block inbound connections from the network where the workspace's Spark clusters are deployed. ** Detailed error message: FATAL: permission denied for database "postgres" Detail: User does not have CONNECT privilege..
I am able to connect in a notebook with the following code. The main difference appears to be that I am supplying the database name, but there is no option for that in the Data Explorer in the Workspace UI.
jdbcURL = f"jdbc:postgresql://{database_creds['host']}/{database_creds['database']}"
Class.forName("org.postgresql.Driver")
df = spark.read.jdbc(url=jdbcURL, table='public.users', properties={'user': USER, 'password': PASSWORD})