Debasish Halder
Debasish Halder

Reputation: 185

Getting schemas from all the available database in snowflake

I am trying to get all the schema from a database which I passed in the connection url in snowflake jdbc driver.

Observation : I am getting all the schema from all the databases even though I pass wrong database. wrong database/schema/warehouse does not validate during the connection creation time.

URL : jdbc:snowflake://XXXXX.region.aws.snowflakecomputing.com?role=custome_role&warehouse=test_wh&db=test_db&schema=test_schema &CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX=true

Why Snowflake JDBC driver does not validate the wrong warehouse/database/schema during connection creation time or query execution time?

Upvotes: 2

Views: 675

Answers (2)

Eliko
Eliko

Reputation: 1

Use

statement.executeQuery("show databases;");

And check if the list contains the requested database

Upvotes: 1

Srinath Menon
Srinath Menon

Reputation: 1640

What I see is that there is no check on the DB name parameter being passed in the connection url. The only check that is done is for Role and if the role is existent then all the db's for that will be listed.

Upvotes: 0

Related Questions