JDBC connection for Snowflake using Key Pair Authentication

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2022 07:19 PM
Hi all,
We are trying to establish JDBC connection to Snowflake using Key Pair Authentication. I have uploaded the Snowflake drivers JAR to Mid Server and configured a data source to build connection string to pass private key and password as per https://docs.snowflake.com/en/user-guide/jdbc-configure.html#using-key-pair-authentication.
However, I am getting following error while loading data into ServiceNow
MID Server reported error: java.sql.SQLException: net.snowflake.client.jdbc.SnowflakeSQLException: Private key provided is invalid or not supported: D:/snowflake/privatekey/rsa_keyP.p8: Cannot retrieve the PKCS8EncodedKeySpec
How can this issue be resolved as our internal security policies to connect Snowflake allow to use only via private that is encrypted?
Thanks!
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2022 07:33 PM
Hi
You can refer to the solutions provided here for the error:
Also, you can refer to this article which discusses about the integration :https://community.servicenow.com/community?id=community_article&sys_id=4f1dc0aadb3670d0457ae6be13961...
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2022 02:53 AM
Hi Sandeep,
Thanks for your help, I am able to compile and connect as per the Snowflake documentation using command prompt.
javac -cp bcprov-jdk18on-171.jar;bcpkix-jdk18on-171.jar JdbcCon.java
java -cp .;snowflake-jdbc-3.13.19.jar;bcprov-jdk18on-171.jar;bcpkix-jdk18on-171.jar JdbcCon.java
Above step has created the following two class files.
JdbcCon.class
JdbcCon$PrivateKeyReader.class
So far so good, however, how can we use these class files with snowflake JDBC drivers in ServiceNow data source?
Any guidance or direction on what will be the next step would be really helpful?
Regards,
Sanjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 02:29 AM
Hello @Sanjay Sharma @Community Alums
I am also looking for connection URL with private key and file path and facing the issue. Below format which is I am using
jdbc❄️//abskf01.eu-central-1.snowflakecomputing.com/?private_key_file=filePath&password=pasowrdstring&warehouse=SKF_CENTRAL_DATASETS_WH&db=PRD_APP_SERVICENOW&schema=TICC&role=SERVICENOW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2025 03:13 PM