<-- Back

How to resolve Snowflake connection issues with Java 17/21 in External Database Connector

Introduction

This article describes how to resolve connection issues when using the External Database Connector with Snowflake in Java 17 or Java 21 environments.

Environment

  • External Database Connector (all versions)

Instructions/Procedure

When using the External Database Connector with Snowflake in Java 17 or 21 environments, the following errors may occur:

For Java 17:

net.snowflake.client.jdbc.SnowflakeSQLException: JDBC driver internal error: exception creating result java.lang.NoClassDefFoundError: Could not initialize class net.snowflake.client.jdbc.internal.apache.arrow.memory.RootAllocator

For Java 21:

net.snowflake.client.jdbc.SnowflakeSQLException: JDBC driver internal error: exception creating result java.lang.ExceptionInInitializerError

 

These errors occur due to compatibility issues with the Apache Arrow result format. To resolve this, the JDBC query result format needs to be changed to JSON at the Snowflake user level as follows:

  1. Connect to the Snowflake instance.
  2. Execute the following SQL command to change the JDBC query result format: 

    ALTER USER <user_name> SET JDBC_QUERY_RESULT_FORMAT='JSON';
  3. Restart the application to apply the changes. 

To revert these changes if needed, execute:

ALTER USER <user_name> UNSET JDBC_QUERY_RESULT_FORMAT;

Outcome

After applying these changes, the External Database Connector will successfully connect to Snowflake and execute queries in Java 17 or 21 environments.

Internal information related

  • 234229, 228650
  • C02SSNWKKH8/p1732623470330059

Additional information 

Other documentation: Getting java.lang.NoClassDefFoundError for class RootAllocator

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.