IBM Support

Snowflake JDBC 3.13.30 driver throws exception Cannot perform SELECT. This session does not have a current database

Troubleshooting


Problem

A Snowflake exception is thrown by the Snowflake JDBC driver when a connection is attempted.
 
net.snowflake.client.jdbc.SnowflakeSQLException: Cannot perform SELECT. This session does not have a current database. Call 'USE DATABASE', or use a qualified name.
	at net.snowflake.client.jdbc.SnowflakeUtil.checkErrorAndThrowExceptionSub(SnowflakeUtil.java:129)
	at net.snowflake.client.jdbc.SnowflakeUtil.checkErrorAndThrowException(SnowflakeUtil.java:70)

Symptom

The <cognos>\drivers folder includes a copy of the Snowflake 3.13.30 JDBC driver.

Cause

Snowflake introduced changes in the 3.13.30 JDBC driver that result in an error when Dynamic Query calls the DatabaseMetadata.getTableTypes method.  The driver attempts to execute an SQL statement that fails.

When users connect to Snowflake it, must be able to establish which warehouse and database will be used.

For example, a connection uses the following URL that includes a warehouse name value pair.
 
jdbc:snowflake://.....snowflakecomputing.com?warehouse=MYWAREHOUSE



For more details, refer to Snowflake's documentation and JDBC driver documentation.
 

Resolving The Problem

Use an older version of the Snowflake JDBC driver.
 
Review how the users default database can be established by Snowflake, such as including the database name value pair in the URL
 
jdbc:snowflake://.....snowflakecomputing.com?warehouse=MYWAREHOUSE&db=MYDB

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSTSF6","label":"IBM Cognos Analytics"},"ARM Category":[{"code":"a8m50000000Cl3zAAC","label":"Administration"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
16 May 2023

UID

ibm16992585