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

[v1.2.0] Failed to set configuration option "allowed_directories", error: Attempted to dereference unique_ptr that is NULL! #137

Open
jivanic-demystdata opened this issue Feb 11, 2025 · 0 comments

Comments

@jivanic-demystdata
Copy link

jivanic-demystdata commented Feb 11, 2025

When trying to set the allowed_directories configuration when starting a new DuckDB instance, I have the following error:

Exception in thread "main" java.sql.SQLException: Catalog Error: Failed to set configuration option "allowed_directories", error: Attempted to dereference unique_ptr that is NULL!
        at org.duckdb.DuckDBNative.duckdb_jdbc_startup(Native Method)
        at org.duckdb.DuckDBConnection.newConnection(DuckDBConnection.java:51)
        at org.duckdb.DuckDBDriver.connect(DuckDBDriver.java:41)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:683)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:191)
        at duck$_.<init>(duck.sc:14)
        at duck_sc$.script$lzyINIT1(duck.sc:29)
        at duck_sc$.script(duck.sc:29)
        at duck_sc$.main(duck.sc:33)
        at duck_sc.main(duck.sc)

To reproduce:

  1. Install scala-cli
    See https://scala-cli.virtuslab.org/install
  2. Create a new file named duck.sc
  3. Copy/paste the following code into the duck.sc file:
//> using dep org.duckdb:duckdb_jdbc:1.2.0

import java.sql.DriverManager
import java.util.Properties

val config = new Properties()
config.put("enable_external_access", "false")
// allowed_directories value took from https://github.com/duckdb/duckdb/blob/f317a112e0c789a11987d9de6d621d8469c00fb8/test/sql/settings/allowed_directories.test#L16
config.put("allowed_directories", "['data/csv/glob']")

DriverManager.getConnection("jdbc:duckdb:", config)
  1. Run the duck.sc file with the bash cmd:
scala-cli duck.sc

Notice that commenting the line config.put("allowed_directories", "['data/csv/glob']") removes the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant