Facing Issues with Databricks JDBC Connectivity after Idle time

AbhiJ
New Contributor III

Hello team, 

I am using commons(commons-dbcp2) Datasource which supports default connection pooling in Spring Java application (rest services to fetch databricks data via JDBC template).

Initially all works fine and can get the data from databricks via jdbc template and already created databricks connection from connection pool.

Databricks JDBC url format is : 

jdbc:databricks://dbc-f2536520-fc66.cloud.databricks.com:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/7781542073893090/0329-163852-fxzadblp;AuthMech=3;UID=token;PWD=<PWDTOKEN>

The databricks jar which I am using for datasource connection is

<dependency>
<groupId>com.databricks</groupId>
<artifactId>databricks-jdbc</artifactId>
<version>2.6.33</version>
</dependency>

The issue is when I stay the running server idle for more than 20 mins, I starts getting below issue from databricks.

[Databricks][DatabricksJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Invalid SessionHandle: SessionHandle [56eea0f9-f7ee-400e-b2f6-5e9cec51c2a4]:62:61, org.apache.hive.service.cli.session.SessionManager:getSession:SessionManager.java:349, org.apache.spark.sql.hive.thriftserver.SparkSQLSessionManager:getSession:SparkSQLSessionManager.scala:179, com.databricks.sql.hive.thriftserver.thrift.ThriftHandlerUtils$:getSessionHandle:ThriftHandlerUtils.scala:55,

 

Please let me know if anyone has faced this issue and what is the resolution for it.