Shailesh Vikram Singh
Shailesh Vikram Singh

Reputation: 1545

No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command

I am using Spring data JPA with snowflake. Even though I have passed warehouse in url but getting below exception while fetching records:

Caused by: net.snowflake.client.jdbc.SnowflakeSQLException: No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.

Below is my application.properties:

spring.datasource.driver-class-name=net.snowflake.client.jdbc.SnowflakeDriver

spring.datasource.url=jdbc:snowflake://domain.snowflakecomputing.com/?db=db_name&warehouse=warehouse_name&role=role_name

spring.datasource.username=username
spring.datasource.password=Abcd#1

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServerDialect
spring.jpa.properties.hibernate.default_schema=schema_name

Please let me know if anyone needs entity class and jpa repository code.

Upvotes: 1

Views: 3229

Answers (1)

peterb
peterb

Reputation: 727

The warehouse parameter is misspelled in you URL string. werehouse should be warehouse.

Also - you can set a default warehouse for any user, so you won't get the above error: alter user <username> set default_warehouse = <warehouse name>

Upvotes: 2

Related Questions