JDBC connection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 07:00 AM
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?
- Labels:
-
Jdbc connection
-
Jvm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 09:59 AM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023 10:13 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2023 11:05 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 01:21 AM
Hi Vidula!
I haven´t figure out a solution yet, so any help would be appreciated
Thank you!

