cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC connection

Joao_DE
New Contributor III

Hi everyone!

I have a question. For a project I need to establish a jdbc connection using spark.read. My question is when does the connection is deleted. That is because I will read multiple tables from that database, so if I could just create a connection and then reuse, it would be better.

If this does not work, is the method dbutils.notebook.exit() able to clean memory on the JVM used and in consequence delete the connection?

4 REPLIES 4

shan_chandra
Honored Contributor III
Honored Contributor III

@João Peixoto​  - Please use %scala System.gc() to explicitly release the free memory from JVM. Please note: JVM process won't explicitly releases memory back as it is an expensive process to request memory again.

Joao_DE
New Contributor III

Hi Shan!

First, thank you for your help. I cannot use scala, because the cluster used is a shared cluster. Can I do the same using python?

Anonymous
Not applicable

Hi @João Peixoto​ 

Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help. 

We'd love to hear from you.

Thanks!

Joao_DE
New Contributor III

Hi Vidula!

I haven´t figure out a solution yet, so any help would be appreciated

Thank you!

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.