Retrieve Data from Snowflake using ServiceNow JDBC

Immanuel Raj
Tera Contributor

Hi Experts,

Need advice on how to get snowflake data to ServiceNow using JDBC connectivity. I was going through this link (https://docs.snowflake.com/en/user-guide/jdbc-using.html) but couldn't find anything relevant. Could someone suggest a different approach to integrate ?


 Refer this Link:https://community.servicenow.com/community?id=community_article&sys_id=4f1dc0aadb3670d0457ae6be13961...

9 REPLIES 9

Santosh70
Tera Expert

@Immanuel Raj ,

 

Hi Raj,

 

were you able to integrate SN with Snowflake through JDBC or by other means? if you have done, could you pls share your input on the same on how we can achieve integration with Snowflake.

 

Regards,

Santosh Kumar S

Hi Santosh,

Yes i was able to integrate SNOWFLAKE with ServiceNow using JDBC Connectivity.

prerequisites:

1. MIDSERVER

2. SNOWFLAKE CREDENTIALS

Below are the steps to integrate with Snowflake.

Step1: Download the latest JAR file from maven repository with extension JAR.

Link:https://repo1.maven.org/maven2/net/snowflake/snowflake-jdbc/

find_real_file.png

Step2: Attach the Downloaded files to ServiceNow below are the steps mentioned.

Navigate -> Mid server ->JAR Files 

Attach the downloaded file and fill out the respective field values.

find_real_file.png 

And then "Submit" the form. Incase you are getting the below error ignore it.

find_real_file.png

This file will be uploaded to MIDSERVER in the folder lib -> extlib. 

Note: When uploading the JAR file from ServiceNow Instance it will be uploaded to all the "Midserver" running on the ServiceNow Instance and automatically all the midserver will be restarted once the JAR file is uploaded. Make sure to do this exercise in non business hours for production Instance.

Step3:

Configuring the DATA SOURCE

Navigate -> System Import sets -> Data Sources 

Create a New Data Source

Select the Type as "JDBCfind_real_file.pngand create a new "Format" as "Snowflake" on the Data source form.

 

find_real_file.png

Label: Snowflake 

Value : net.snowflake.client.jdbc.SnowflakeDriver (Snowflake Class Name)

This can also be referenced in this website : https://docs.snowflake.com/en/user-guide/jdbc-configure.html#other-parameters

 

Sample Datasource Form:

find_real_file.png

 

MIDSERVER: Use any of your MID Server (Because the JAR will be Loaded onto all MIDSERVERS on your Instance)

DATABASENAME : SNOWFLAKE DATABASE NAME from which you're retrieving the data.

USERNAME: SNOWFLAKE USERNAME

PASSWORD: SNOWFLAKE PASSWORD

 

Step:4 

Setting up Connection URL to communicate with SNOWFLAKE

Create a "Before Insert BR" on the Data source table to dynamically construct the Connection URL with conditions.

find_real_file.png

Script:

find_real_file.png

SAMPLE CONNECTION URL:

current.connection_url = "jdbc:snowflake://YOUR ACCOUNT NAME.YOUR REGION.snowflakecomputing.com/?user=" + current.jdbc_user_name + "&password=" + current.jdbc_password + "&warehouse=YOUR WAREHOUSE NAME &db=" + current.database_name + "&schema= YOUR SCHEMA NAME FROM SNOWFLAKE &role= YOUR SNOWFLAKE ROLE NAME";

 

YOUR ACCOUNT NAME : SNOWFLAKE ACCOUNT NAME

YOUR REGION : This differs based on the region (E.g for US starts with (us.east..) for EUROPE -> (eu.central )

USER: It will be retrieved from Datasource "Username" field.

PASSWORD: It will be retrieved from Datasource "Password" field.

WAREHOUSE : YOUR SNOWFLAKE WAREHOUSE NAME

DATABASE (db) : It will be retrieved from Datasource "Database" field.

SCHEMA : YOUR SCHEMA NAME FROM SNOWFLAKE

ROLE: YOUR SNOWFLAKE ROLE NAME

 

NOTE: Ask SNOWFLAKE team to create a local account with Basic Authentication method for the Servicenow user inorder to communicate with SNOWFLAKE.

After setting all this you should be able to Test load 20 records from SNOWFLAKE.

 

Referal Liks and Docs:

https://docs.snowflake.com/en/user-guide/jdbc-configure.html#other-parameters

https://docs.snowflake.com/en/user-guide/admin-account-identifier.html

https://docs.snowflake.com/en/user-guide/jdbc-configure.html#jdbc-driver-class

https://docs.snowflake.com/en/user-guide/jdbc-configure.html#jdbc-driver-connection-string

Hi Raj,
I tried to follow all the steps and still when I test load 20 records I am getting and error as "java.sql.SQLException: java.sql.SQLException: No suitable driver found for jdbc:snowflake//XXXXXXX.snowflakecomputing.com/?user=XXXXX&password=XXXXXX&warehouse=XXXXX&db=XXXX&schema= XXXX&role= XXXXXXX"
java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)

Not sure what's really wrong here. The JAR file is also in place. Although I did find a KB https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1120253
with an issue & the fix, But even after that fix the error is the same.

Any suggestions??

Hello all,

 

Same issue am facing even though i have followed all the step, i have tired 3.13.0 and 3.13.6 jar files still same issue. please help.

 

Thanks,

Hemanesh