Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@

It's required to have a JDK installed to build.
Make sure the `JAVA_HOME` environment variable is set.

If you are on a Mac and install `openjdk` via `brew` then additionally, it's required to set:
```
export JAVA_AWT_LIBRARY=$JAVA_HOME/libexec/openjdk.jdk/Contents/Home/lib
```
because the [`FindJNI.cmake`](https://cmake.org/cmake/help/latest/module/FindJNI.html) module doesn't look there for the `awt` library.

### Development

Be sure to build with `DISABLE_SANITIZER=1` and `BUILD_JDBC=1` enabled
To build the driver, run `make release`.


This will produce two jars in the build folder:
`build/<build_type>/tools/jdbc/duckdb_jdbc.jar`
`build/<build_type>/tools/jdbc/duckdb_jdbc_tests.jar`
`build/release/duckdb_jdbc.jar`
`build/release/duckdb_jdbc_tests.jar`

The tests can be ran using this command (taking a `debug` build for example)
The tests can be ran using using `make test` or this command
```
java -cp "build/debug/tools/jdbc/duckdb_jdbc_tests.jar:build/debug/tools/jdbc/duckdb_jdbc.jar" org/duckdb/TestDuckDBJDBC
java -cp "build/release/duckdb_jdbc_tests.jar:build/release/duckdb_jdbc.jar" org/duckdb/TestDuckDBJDBC
```

This optionally takes an argument to only run a single test, for example:
```
java -cp "build/debug/tools/jdbc/duckdb_jdbc_tests.jar:build/debug/tools/jdbc/duckdb_jdbc.jar" org/duckdb/TestDuckDBJDBC test_valid_but_local_config_throws_exception
java -cp "build/release/duckdb_jdbc_tests.jar:build/release/duckdb_jdbc.jar" org/duckdb/TestDuckDBJDBC test_valid_but_local_config_throws_exception
```
2 changes: 1 addition & 1 deletion header2whatever.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- headers:
- "../../build/debug/tools/jdbc/CMakeFiles/duckdb_jdbc.dir/native_headers/org_duckdb_DuckDBNative.h"
- "build/release/CMakeFiles/duckdb_jdbc.dir/native_headers/org_duckdb_DuckDBNative.h"
hooks: generator.py
templates:
- src: "src/jni/functions.hpp.template"
Expand Down
147 changes: 62 additions & 85 deletions src/jni/functions.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/jni/functions.cpp.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by tools/jdbc/generator.py
// This file was generated by generator.py

#include "org_duckdb_DuckDBNative.h"
#include "functions.hpp"
Expand Down
198 changes: 76 additions & 122 deletions src/jni/functions.hpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/jni/functions.hpp.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by tools/jdbc/generator.py
// This file was generated by generator.py

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/duckdb/DuckDBNative.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DuckDBNative {
URL lib_res = DuckDBNative.class.getResource(lib_res_name);
if (lib_res == null) {
System.load(
Paths.get("../../build/debug/tools/jdbc", lib_res_name).normalize().toAbsolutePath().toString());
Paths.get("../../build/release", lib_res_name).normalize().toAbsolutePath().toString());
} else {
try (final InputStream lib_res_input_stream = lib_res.openStream()) {
Files.copy(lib_res_input_stream, lib_file, StandardCopyOption.REPLACE_EXISTING);
Expand Down