Hi @olegmir, Based on the provided information and code, it seems like there is a thread leakage issue when getConnection()
it fails in the Databricks JDBC driver. The code provided continuously tries to establish a connection using the DataSource
and prints the thread count when an exception occurs.
To address this issue, you can try the following approaches:
1. Close the connection: Close it after it is used, even in case of exceptions. This can be done by adding a connection.close()
statement in the catch
block.
2. Use connection pooling: Implement connection pooling to manage and reuse connections efficiently. This can help reduce the number of threads created and improve performance. You can use libraries like HikariCP or Apache Commons DBCP for connection pooling.
3. Increase the maximum number of threads: If the number of lines reaches a limit, you can increase the maximum number of lines the JVM allows. This can be done by setting the -XX:ThreadMax
JVM option.