Support loading native lib directly from FS (1.4)#459
Merged
staticlibs merged 1 commit intoduckdb:v1.4-andiumfrom Nov 10, 2025
Merged
Support loading native lib directly from FS (1.4)#459staticlibs merged 1 commit intoduckdb:v1.4-andiumfrom
staticlibs merged 1 commit intoduckdb:v1.4-andiumfrom
Conversation
This is a backport of the PR duckdb#450 to `v1.4-andium` stable branch. This PR is a continuation of duckdb#447 PR to allow using `duckdb_jdbc-x.x.x.x-nolib.jar` along with a JNI native library, that is loaded directly from file system. It extends the idea from duckdb#421 (and supersedes it) implementing the following logic: 1. if the driver JAR has a bundled native library (for current JVM os/arch), then this library will be unpacked to the temporary directory and loaded from there. If the library cannot be unpacked or loaded - there is no fallback to other methods (it is expected that `-nolib` JAR is used for other loading methods) 2. if the driver JAR does not hava a native library bundled inside it, then it will try to load it with: ```java System.loadLibrary("duckdb_java"); ``` This call will search the library in `java.library.path` (using a platform-specific file name like `duckdb_java.dll`) or will use other methods defined by the host application. 3. if the native library cannot be loaded by name, then the driver will check whether a file with the DuckDB internal naming (like `libduckdb_java.so_linux_amd64`) exists in file system next to the driver JAR (in the same directory). If the library file is found there - then the driver will attempt to load it as the last resort. Testing: new test added that covers loading from the same dir and loading by name. Fixes: duckdb#444
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of the PR #450 to
v1.4-andiumstable branch.This PR is a continuation of #447 PR to allow using
duckdb_jdbc-x.x.x.x-nolib.jaralong with a JNI native library, that is loaded directly from file system.It extends the idea from #421 (and supersedes it) implementing the following logic:
if the driver JAR has a bundled native library (for current JVM os/arch), then this library will be unpacked to the temporary directory and loaded from there. If the library cannot be unpacked or loaded - there is no fallback to other methods (it is expected that
-nolibJAR is used for other loading methods)if the driver JAR does not hava a native library bundled inside it, then it will try to load it with:
This call will search the library in
java.library.path(using a platform-specific file name likeduckdb_java.dll) or will use other methods defined by the host application.libduckdb_java.so_linux_amd64) exists in file system next to the driver JAR (in the same directory). If the library file is found there - then the driver will attempt to load it as the last resort.Testing: new test added that covers loading from the same dir and loading by name.
Fixes: #444