cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

No database name field for PostgreSQL connection

jlmontie
New Contributor II

I'm trying to get my workspace setup by connecting to my PostgreSQL database. I am following this article. The instructions under "Create a connection" are failing because my connection requires a database name. However, the database name is not a supported variable. What options do I have to connect to my database?

2 REPLIES 2

Kaniz_Fatma
Community Manager
Community Manager

Hi @jlmontie , Could you share the error stack?

 

jlmontie
New Contributor II

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})

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group