parameters) throws AdbcException {
+ String driver = PARAM_DRIVER.get(parameters);
+ if (driver == null) {
+ throw AdbcException.invalidArgument(
+ "[Flight SQL] Must provide String " + PARAM_DRIVER + " parameter");
+ }
+
+ NativeDriver d = JniLoader.INSTANCE.loadDriver(driver);
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/JniDriverFactory.java b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/JniDriverFactory.java
new file mode 100644
index 0000000000..b67a534fd5
--- /dev/null
+++ b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/JniDriverFactory.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adbc.driver.jni;
+
+import org.apache.arrow.adbc.core.AdbcDriver;
+import org.apache.arrow.adbc.drivermanager.AdbcDriverFactory;
+import org.apache.arrow.memory.BufferAllocator;
+
+/** Constructs new JniDriver instances. */
+public class JniDriverFactory implements AdbcDriverFactory {
+ @Override
+ public AdbcDriver getDriver(BufferAllocator allocator) {
+ return new JniDriver(allocator);
+ }
+}
diff --git a/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/JniLoader.java b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/JniLoader.java
new file mode 100644
index 0000000000..be94bc40db
--- /dev/null
+++ b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/JniLoader.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adbc.driver.jni.impl;
+
+public enum JniLoader {
+ INSTANCE;
+
+ JniLoader() {
+ // TODO: implement logic to unpack the library from resources as well
+ Runtime.getRuntime()
+ .load("/home/lidavidm/Code/arrow-adbc/java/build/driver/jni/libadbc_drvier_jni.so");
+ }
+
+ public NativeDriver loadDriver(String driver) {
+ try {
+ return NativeAdbc.loadDriver(driver, null, 1001000);
+ } catch (NativeAdbcException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeAdbc.java b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeAdbc.java
new file mode 100644
index 0000000000..d2156d14c9
--- /dev/null
+++ b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeAdbc.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adbc.driver.jni.impl;
+
+public class NativeAdbc {
+ public static native NativeDriver loadDriver(String driverName, String entrypoint, int version)
+ throws NativeAdbcException;
+}
diff --git a/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeAdbcException.java b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeAdbcException.java
new file mode 100644
index 0000000000..ef205770d3
--- /dev/null
+++ b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeAdbcException.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adbc.driver.jni.impl;
+
+/**
+ * Wrapper for a {@code struct AdbcException} that doesn't depend on other Java code.
+ *
+ * This breaks a dependency chain in compilation. If we directly used AdbcException, then we
+ * would need to compile the Java code before compiling JNI code, but we need the compiled JNI code
+ * to compile the Java code.
+ */
+public class NativeAdbcException extends Exception {
+ public NativeAdbcException(String message) {
+ super(message);
+ }
+}
diff --git a/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeDriver.java b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeDriver.java
new file mode 100644
index 0000000000..237716cfa8
--- /dev/null
+++ b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/impl/NativeDriver.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adbc.driver.jni.impl;
+
+import java.lang.ref.Cleaner;
+
+public class NativeDriver implements AutoCloseable {
+ static final Cleaner cleaner = Cleaner.create();
+
+ private final State state;
+ private final Cleaner.Cleanable cleanable;
+
+ NativeDriver(long nativeHandle) {
+ this.state = new State(nativeHandle);
+ this.cleanable = cleaner.register(this, state);
+ }
+
+ @Override
+ public void close() {
+ cleanable.clean();
+ }
+
+ private static class State implements Runnable {
+ long nativeHandle;
+
+ State(long nativeHandle) {
+ this.nativeHandle = nativeHandle;
+ }
+
+ @Override
+ public void run() {
+ if (nativeHandle == 0) return;
+ // TODO: dispose
+ nativeHandle = 0;
+ }
+ }
+}
diff --git a/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/package-info.java b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/package-info.java
new file mode 100644
index 0000000000..ed2ba096a8
--- /dev/null
+++ b/java/driver/jni/src/main/java/org/apache/arrow/adbc/driver/jni/package-info.java
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adbc.driver.jni;
diff --git a/java/driver/jni/src/main/resources/META-INF/services/org.apache.arrow.adbc.drivermanager.AdbcDriverFactory b/java/driver/jni/src/main/resources/META-INF/services/org.apache.arrow.adbc.drivermanager.AdbcDriverFactory
new file mode 100644
index 0000000000..c592768f18
--- /dev/null
+++ b/java/driver/jni/src/main/resources/META-INF/services/org.apache.arrow.adbc.drivermanager.AdbcDriverFactory
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.arrow.adbc.driver.jni.NativeDriverFactory
diff --git a/java/driver/jni/src/test/java/org/apache/arrow/adbc/driver/jni/JniDriverTest.java b/java/driver/jni/src/test/java/org/apache/arrow/adbc/driver/jni/JniDriverTest.java
new file mode 100644
index 0000000000..6b0c2ed486
--- /dev/null
+++ b/java/driver/jni/src/test/java/org/apache/arrow/adbc/driver/jni/JniDriverTest.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.adbc.driver.jni;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.arrow.adbc.core.AdbcDatabase;
+import org.apache.arrow.memory.BufferAllocator;
+import org.apache.arrow.memory.RootAllocator;
+import org.junit.jupiter.api.Test;
+
+class JniDriverTest {
+ @Test
+ void minimal() throws Exception {
+ try (final BufferAllocator allocator = new RootAllocator()) {
+ JniDriver driver = new JniDriver(allocator);
+ Map parameters = new HashMap<>();
+ JniDriver.PARAM_DRIVER.set(parameters, "adbc_driver_sqlite");
+
+ try (final AdbcDatabase db = driver.open(parameters)) {}
+ }
+ }
+}
diff --git a/java/pom.xml b/java/pom.xml
index 6b80751167..f4a26e8793 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -66,6 +66,7 @@
driver/jdbc-validation-derby
driver/jdbc-validation-mssqlserver
driver/jdbc-validation-postgresql
+ driver/jni
driver/validation
driver-manager
sql