cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

display() function always return connection refused on tunneling despite successfully retrieving the schema

antoooks
New Contributor III

Hi everyone,

I am using SSH tunnelling with SSHTunnelForwarder to reach a target AWS RDS PostgreSQL database. The connection got through, however when I tried to display the retrieved data frame it always throws "connection refused" error. Please see screenshot below for clarity. I don't understand how this function works, it seems like it does not reuse the established connection from sparks.read command. Can somebody help me on this?

What I already tried:

  • SSH into the cluster, try tunnelling, and psql from there [works]
  • directly connect to db instance from proxy host [works]
  • Using panda to load the data frame instead of sparks [does not work]
  • Create new SSH key pair for Databricks [does not work]
  • Change postgresql.conf listen_address to ''*"

Screenshot:

image.png 

Thanks.

Regards,

Kurnianto

1 ACCEPTED SOLUTION

Accepted Solutions

jose_gonzalez
Databricks Employee
Databricks Employee

hi @Kurnianto Trilaksono Sutjiptoโ€‹ ,

This seems like a connectivity issue with the url you are trying to connect to. It fails during the display() command because read is a lazy transformation and it will not be executed right away. On the other hand, display() is an action and it will trigger the lazy transformation.

The following doc will help you to check if you can connect tho this host docs

View solution in original post

2 REPLIES 2

jose_gonzalez
Databricks Employee
Databricks Employee

hi @Kurnianto Trilaksono Sutjiptoโ€‹ ,

This seems like a connectivity issue with the url you are trying to connect to. It fails during the display() command because read is a lazy transformation and it will not be executed right away. On the other hand, display() is an action and it will trigger the lazy transformation.

The following doc will help you to check if you can connect tho this host docs

If you would like to check for connectivity from databricks to your host, please execute the following command in your notebook.

%sh nc -vz <jdbcHostname> <jdbcPort>

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