cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Warehouse cluster is always running when configure metabase conneciton

xfun
New Contributor II

I encountered an issue while using the Metabase JDBC driver to connect to Databricks SQL Warehouse: I noticed that the SQL Warehouse cluster is always running and never stops automatically. Every few seconds, a SELECT 1 query log appears, which I suspect might be Metabase JDBC Databricks driver's method of maintaining a persistent connection, though I'm not entirely sure. I'm wondering how to configure it so that when no one is using Metabase, the SQL Warehouse does not continuously execute the SELECT 1 query, and the SQL Warehouse can appropriately stop.

···

(defmethod sql-jdbc.conn/data-warehouse-connection-pool-properties :hive-like
[driver database]
;; The Hive JDBC driver doesn't support `Connection.isValid()`, so we need to supply a test query for c3p0 to use to
;; validate connections upon checkout.
(merge
((get-method sql-jdbc.conn/data-warehouse-connection-pool-properties :sql-jdbc) driver database)
{"preferredTestQuery" "SELECT 1"}))

···

 

2 REPLIES 2

xfun
New Contributor II

Will try to remove "preferredTestQuery" or add "idleConnectionTestPeriod" to avoid keep send select 1 query. 

Kaniz_Fatma
Community Manager
Community Manager

Hi @xfun, One option is to increase the SocketTimeout value in the JDBC connection URL. This can help avoid a timeout when the number of simultaneous requests is greater than the number of....

 

Another option is to use a different version of the Metabase JDBC driver that supports c3p0 connection pool. According to this GitHub issue, the latest version of the driver (v46) does not have this problem, and it uses a simpler jdbc:databricks URL schema. You can find more details on installing and using this driver on this GitHub repository.

 

I hope this helps you resolve your issue. If you have any other questions, please feel free to ask me. 😊

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