snowflake-jdbc: SNOW-755767: snowflake-jdbc driver fails with JDK >= 16
env: mac v11.6 intellij openjdk17 snowflake-driver v3.13.8 jar from maven repo
stack trace:
Exception in thread "main" net.snowflake.client.jdbc.SnowflakeSQLLoggedException: JDBC driver internal error: Fail to retrieve row count for first arrow chunk: sun.misc.Unsafe or java.nio.DirectByteBuffer.<init>(long, int) not available. at net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1.setFirstChunkRowCountForArrow(SnowflakeResultSetSerializableV1.java:1061) at net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1.create(SnowflakeResultSetSerializableV1.java:550) at net.snowflake.client.jdbc.SnowflakeResultSetSerializableV1.create(SnowflakeResultSetSerializableV1.java:467) at net.snowflake.client.core.SFResultSetFactory.getResultSet(SFResultSetFactory.java:29) at net.snowflake.client.core.SFStatement.executeQueryInternal(SFStatement.java:219) at net.snowflake.client.core.SFStatement.executeQuery(SFStatement.java:134) at net.snowflake.client.core.SFStatement.execute(SFStatement.java:743) at net.snowflake.client.core.SFStatement.execute(SFStatement.java:639) at net.snowflake.client.jdbc.SnowflakeStatementV1.executeQueryInternal(SnowflakeStatementV1.java:238) at net.snowflake.client.jdbc.SnowflakeStatementV1.executeQuery(SnowflakeStatementV1.java:133)
workaround: Change jdk17 to jdk11.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 32
- Comments: 30
Commits related to this issue
- [#589] Experiment with upgrading netty to JDK11+ — committed to divebell/snowflake-jdbc by arrdem 2 years ago
- jmeter: use openjdk 11 - This addresses issues with snowflake driver upstream issue: https://github.com/snowflakedb/snowflake-jdbc/issues/589 - There already was attempt to fix this issue: previ... — committed to turboMaCk/homebrew-core by turboMaCk a year ago
- fix(gradle): opens java.util and java.io to workaround issues with some libraries At least Snowflake and Azure Batch. https://github.com/snowflakedb/snowflake-jdbc/issues/589 https://github.com/Azure... — committed to kestra-io/kestra by loicmathieu a year ago
I also vote for fixing it. For me, the driver fails even with the add-opens flag.
Just noting another workaround (not ideal): https://github.com/snowflakedb/snowflake-jdbc/issues/533
ALTER SESSION SET JDBC_QUERY_RESULT_FORMAT='JSON'Or in the jdbc url:&JDBC_QUERY_RESULT_FORMAT=JSONThis is what we’ve used for a few months without issue.
@LiamAttardcol FYI, I wrote this article to explain the nature of the problem. I welcome any feedback if there’s something more I can add there to improve it: JDBC Driver Compatibility Issue With JDK 16 and Later
@sfc-gh-kdama @sfc-gh-mknister Could you please look at this issue? It seems like #682 solves that. Releasing this would be really appreciated because our snowflake apps are failing with JDK17. Is there any chance to include this fix in the next following release?
I still face the same issue. JDK 17, Spring Boot 3 and Snowflake JDBC version 3.13.28. Thanks
It looks that ARROW-12747 was finally resolved three days ago in version 8.0.0. I was able to build
snowflake-jdbcproject with shaded arrow 8.0.0 and it became usable under Java 17. Still had to add--add-opens java.base/java.nio=ALL-UNNAMED, though. Let’s hope that we’ll get soon a new snowflake-jdbc:3.13.19 release with upgraded arrow that will be finally compatible with Java 17. =)Adding the JVM argument: --add-opens java.base/java.nio=ALL-UNNAMED seems to solve the problem.
This should be addressed in #1017
Oh. It seems I got deceived by long-awaited eager expectations. Sorry for spammy false alarm. Will have to train attentiveness and patience a bit longer. )
I haven’t tested, but are you sure @vkopichenko ? Snowflake 3.13.19 is using Arrow 7: https://github.com/snowflakedb/snowflake-jdbc/blob/v3.13.19/pom.xml#L40 But the fix is only included in Arrow 8: https://issues.apache.org/jira/browse/ARROW-12747