Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating DuckDB in-memory connection throws exception [Java API] #12113

Closed
2 tasks done
grjzwaan opened this issue May 17, 2024 · 2 comments
Closed
2 tasks done

Creating DuckDB in-memory connection throws exception [Java API] #12113

grjzwaan opened this issue May 17, 2024 · 2 comments
Labels
expected behavior The behavior described in the issue is expected needs triage

Comments

@grjzwaan
Copy link

What happens?

When executing the following snippet in a Tomcat server I get an exception:

Class.forName("org.duckdb.DuckDBDriver");
DuckDBConnection conn = (DuckDBConnection) DriverManager.getConnection("jdbc:duckdb:");

Exception:

java.lang.ExceptionInInitializerError: Exception java.lang.RuntimeException: java.nio.file.AccessDeniedException: C:\Program Files (x86)\apache-tomcat-9.0.69\temp\libduckdb_java16991498082687051807.so [in thread "http-nio-8080-exec-10"]

Stacktrace:

0 = {StackTraceElement@12379} "org.duckdb.DuckDBConnection.newConnection(DuckDBConnection.java:48)"
1 = {StackTraceElement@12380} "org.duckdb.DuckDBDriver.connect(DuckDBDriver.java:41)"
2 = {StackTraceElement@12381} "java.sql/java.sql.DriverManager.getConnection(DriverManager.java:683)"
3 = {StackTraceElement@12382} "java.sql/java.sql.DriverManager.getConnection(DriverManager.java:253)"

I followed the instruction/installation of duckdb on the website and included it as a maven dependency:

<dependency>
	<groupId>org.duckdb</groupId>
	<artifactId>duckdb_jdbc</artifactId>
	<version>0.10.2</version>
</dependency>

To Reproduce

Class.forName("org.duckdb.DuckDBDriver");
DuckDBConnection conn = (DuckDBConnection) DriverManager.getConnection("jdbc:duckdb:");

Tomcat 9
Windows 11

OS:

Windows 11 Pro

DuckDB Version:

10.2

DuckDB Client:

Java

Full Name:

Ruben van der Zwaan

Affiliation:

Personal project

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@Mause
Copy link
Member

Mause commented May 17, 2024

The issue here is that the process doesn't have access to write to the configured temporary directory for some reason, so I'd suggest looking into that

@Mause Mause added the expected behavior The behavior described in the issue is expected label May 17, 2024
@grjzwaan
Copy link
Author

Aah...apologies! Makes total sense, and I've got it working.

I was somehow completely thrown for a loop by the attempt to open/create an libduckdb.so in the temporary folder under windows, and stopped thinking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expected behavior The behavior described in the issue is expected needs triage
Projects
None yet
Development

No branches or pull requests

2 participants