You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by Great Info <gu...@gmail.com> on 2021/11/28 06:23:52 UTC

Zeppelin how to set extra properties to Connect Snowflake

Hi,
I am trying to configure jdbc(sql) to connect to snowflake, I need to add
some extra properties related to some sssk keypair like *prop.put("privateKey",
PrivateKeyReader.get(PRIVATE_KEY_FILE)); *
I tried below code in java, it works but how to add same in Zeppelin ? I
could not see any option to add extra option in jdbc interceptors . Is it
possible to add these extra props?



String url = "jdbc:snowflake://<account_identifier>.snowflakecomputing.com";
    Properties prop = new Properties();
    prop.put("user", "<user>");
    prop.put("privateKey", PrivateKeyReader.get(PRIVATE_KEY_FILE));
    prop.put("db", "<database_name>");
    prop.put("schema", "<schema_name>");
    prop.put("warehouse", "<warehouse_name>");
    prop.put("role", "<role_name>");

    Connection conn = DriverManager.getConnection(url, prop);
    Statement stat = conn.createStatement();
    ResultSet res = stat.executeQuery("select 1");
    res.next();
    System.out.println(res.getString(1));
    conn.close();

Re: Zeppelin how to set extra properties to Connect Snowflake

Posted by Jeff Zhang <zj...@gmail.com>.
Try to add property default.xxx to your jdbc interpreter setting.

Great Info <gu...@gmail.com> 于2021年11月28日周日 下午2:24写道:

>
> Hi,
> I am trying to configure jdbc(sql) to connect to snowflake, I need to add
> some extra properties related to some sssk keypair like *prop.put("privateKey",
> PrivateKeyReader.get(PRIVATE_KEY_FILE)); *
> I tried below code in java, it works but how to add same in Zeppelin ? I
> could not see any option to add extra option in jdbc interceptors . Is it
> possible to add these extra props?
>
>
>
> String url = "jdbc:snowflake://<account_identifier>.snowflakecomputing.com";
>     Properties prop = new Properties();
>     prop.put("user", "<user>");
>     prop.put("privateKey", PrivateKeyReader.get(PRIVATE_KEY_FILE));
>     prop.put("db", "<database_name>");
>     prop.put("schema", "<schema_name>");
>     prop.put("warehouse", "<warehouse_name>");
>     prop.put("role", "<role_name>");
>
>     Connection conn = DriverManager.getConnection(url, prop);
>     Statement stat = conn.createStatement();
>     ResultSet res = stat.executeQuery("select 1");
>     res.next();
>     System.out.println(res.getString(1));
>     conn.close();
>
>

-- 
Best Regards

Jeff Zhang

Re: Zeppelin how to set extra properties to Connect Snowflake

Posted by Jeff Zhang <zj...@gmail.com>.
Try to add property default.xxx to your jdbc interpreter setting.

Great Info <gu...@gmail.com> 于2021年11月28日周日 下午2:24写道:

>
> Hi,
> I am trying to configure jdbc(sql) to connect to snowflake, I need to add
> some extra properties related to some sssk keypair like *prop.put("privateKey",
> PrivateKeyReader.get(PRIVATE_KEY_FILE)); *
> I tried below code in java, it works but how to add same in Zeppelin ? I
> could not see any option to add extra option in jdbc interceptors . Is it
> possible to add these extra props?
>
>
>
> String url = "jdbc:snowflake://<account_identifier>.snowflakecomputing.com";
>     Properties prop = new Properties();
>     prop.put("user", "<user>");
>     prop.put("privateKey", PrivateKeyReader.get(PRIVATE_KEY_FILE));
>     prop.put("db", "<database_name>");
>     prop.put("schema", "<schema_name>");
>     prop.put("warehouse", "<warehouse_name>");
>     prop.put("role", "<role_name>");
>
>     Connection conn = DriverManager.getConnection(url, prop);
>     Statement stat = conn.createStatement();
>     ResultSet res = stat.executeQuery("select 1");
>     res.next();
>     System.out.println(res.getString(1));
>     conn.close();
>
>

-- 
Best Regards

Jeff Zhang