Unable to load sqlite database file

When I point metabase to a sqlite file, I get Error opening connection. I think this error is related metabase not being able to create a file in the /tmp directory. Any thoughts on how to resolve it? /tmp permission looks correct.

Failed to load native library:sqlite-3.36.0.1-54fb1114-27bf-4786-a13e-b532768bee12-libsqlitejdbc.so. osinfo: Linux/x86_64
java.lang.UnsatisfiedLinkError: /tmp/sqlite-3.36.0.1-54fb1114-27bf-4786-a13e-b532768bee12-libsqlitejdbc.so: /tmp/sqlite-3.36.0.1-54fb1114-27bf-4786-a13e-b532768bee12-libsqlitejdbc.so: failed to map segment from shared object
2024-06-04 14:29:27,292 ERROR driver.util :: Database connection error
java.sql.SQLException: Error opening connection
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:244)
at org.sqlite.SQLiteConnection.(SQLiteConnection.java:61)
at org.sqlite.jdbc3.JDBC3Connection.(JDBC3Connection.java:28)
at org.sqlite.jdbc4.JDBC4Connection.(JDBC4Connection.java:21)
at org.sqlite.JDBC.createConnection(JDBC.java:115)
at org.sqlite.JDBC.connect(JDBC.java:90)
at metabase.plugins.jdbc_proxy$proxy_driver$reify__57460.connect(jdbc_proxy.clj:33)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR_.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invokeStatic(connection.clj:245)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:242)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:253)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:249)
at metabase.driver.sqlite$fn__82485.invokeStatic(sqlite.clj:56)
at metabase.driver.sqlite$fn__82485.invoke(sqlite.clj:53)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at metabase.driver.util$can_connect_with_details_QMARK_$fn__24608.invoke(util.clj:43)
at metabase.util$do_with_timeout$fn__6174.invoke(util.clj:354)
at clojure.core$binding_conveyor_fn$fn__5772.invoke(core.clj:2034)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=x86_64, paths=[/org/sqlite/native/Linux/x86_64:/apps/apps/bin/sqlite-tools-linux-x86-3400100:/apps/apps/bin/clidriver/lib:/opt/teradata/client/17.10/lib64:/opt/teradata/client/17.10/tbuild/lib64:/opt/teradata/client/17.10/tdicu/lib64:/usr/lib/lib_64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:389)
at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:68)
at org.sqlite.core.NativeDB.load(NativeDB.java:63)
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:240)
... 33 more
2024-06-04 14:29:27,294 ERROR api.database :: Cannot connect to Database
java.lang.Exception: Error opening connection
at metabase.driver.util$can_connect_with_details_QMARK_.invokeStatic(util.clj:48)
at metabase.driver.util$can_connect_with_details_QMARK_.doInvoke(util.clj:31)
at clojure.lang.RestFn.invoke(RestFn.java:442)
at metabase.api.database$test_database_connection.invokeStatic(database.clj:421)
at metabase.api.database$test_database_connection.doInvoke(database.clj:411)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at metabase.api.database$fn__77076$test_connection_details__77081$fn__77082.invoke(database.clj:468)
at metabase.api.database$fn__77076$test_connection_details__77081.invoke(database.clj:450)
at metabase.api.database$fn__77108.invokeStatic(database.clj:488)
at metabase.api.database$fn__77108.invoke(database.clj:474)
at compojure.core$wrap_response$fn__32066.invoke(core.clj:160)
at compojure.core$wrap_route_middleware$fn__32050.invoke(core.clj:132)
at compojure.core$wrap_route_info$fn__32055.invoke(core.clj:139)
at compojure.core$wrap_route_matches$fn__32059.invoke(core.clj:151)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078.invoke(core.clj:200)
at metabase.server.middleware.auth$enforce_authentication$fn__70282.invoke(auth.clj:14)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078.invoke(core.clj:200)
at compojure.core$make_context$handler__32106.invoke(core.clj:289)
at compojure.core$make_context$fn__32110.invoke(core.clj:299)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$make_context$fn__32110.invoke(core.clj:300)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$make_context$fn__32110.invoke(core.clj:300)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$make_context$fn__32110.invoke(core.clj:300)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$make_context$fn__32110.invoke(core.clj:300)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$make_context$fn__32110.invoke(core.clj:300)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$make_context$fn__32110.invoke(core.clj:300)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at metabase.api.routes$fn__79759$fn__79762.invoke(routes.clj:56)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078.invoke(core.clj:200)
at clojure.lang.AFn.applyToHelper(AFn.java:160)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$apply.invoke(core.clj:662)
at metabase.server.routes$fn__79904$fn__79905.doInvoke(routes.clj:57)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078.invoke(core.clj:200)
at compojure.core$make_context$handler__32106.invoke(core.clj:289)
at compojure.core$make_context$fn__32110.invoke(core.clj:299)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$wrap_route_matches$fn__32059.invoke(core.clj:153)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$wrap_route_matches$fn__32059.invoke(core.clj:153)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at compojure.core$wrap_route_matches$fn__32059.invoke(core.clj:153)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078$f__32079$respond_SINGLEQUOTE___32080.invoke(core.clj:197)
at metabase.server.routes$fn__79892$fn__79894.invoke(routes.clj:41)
at compojure.core$routes$fn__32078$f__32079.invoke(core.clj:198)
at compojure.core$routes$fn__32078.invoke(core.clj:200)
at metabase.server.middleware.exceptions$catch_uncaught_exceptions$fn__77364.invoke(exceptions.clj:98)
at metabase.server.middleware.exceptions$catch_api_exceptions$fn__77361.invoke(exceptions.clj:86)
at metabase.server.middleware.log$log_api_call$fn__80359$fn__80360$fn__80361.invoke(log.clj:209)
at metabase.driver.sql_jdbc.execute.diagnostic$do_with_diagnostic_info.invokeStatic(diagnostic.clj:15)
at metabase.driver.sql_jdbc.execute.diagnostic$do_with_diagnostic_info.invoke(diagnostic.clj:9)
at metabase.server.middleware.log$log_api_call$fn__80359$fn__80360.invoke(log.clj:201)
at toucan.db$do_with_call_counting.invokeStatic(db.clj:216)
at toucan.db$do_with_call_counting.invoke(db.clj:209)
at metabase.server.middleware.log$log_api_call$fn__80359.invoke(log.clj:200)
at metabase.server.middleware.browser_cookie$ensure_browser_id_cookie$fn__83572.invoke(browser_cookie.clj:30)
at metabase.server.middleware.security$add_security_headers$fn__59226.invoke(security.clj:147)
at metabase.server.middleware.json$wrap_json_body$fn__82716.invoke(json.clj:62)
at metabase.server.middleware.json$wrap_streamed_json_response$fn__82734.invoke(json.clj:98)
at metabase.server.middleware.offset_paging$handle_paging$fn__59250.invoke(offset_paging.clj:42)
at ring.middleware.keyword_params$wrap_keyword_params$fn__83839.invoke(keyword_params.clj:55)
at ring.middleware.params$wrap_params$fn__83855.invoke(params.clj:69)
at metabase.server.middleware.misc$maybe_set_site_url$fn__34077.invoke(misc.clj:59)
at metabase.server.middleware.session$bind_current_user$fn__44978$fn__44979.invoke(session.clj:257)
at metabase.server.middleware.session$do_with_current_user.invokeStatic(session.clj:238)
at metabase.server.middleware.session$do_with_current_user.invoke(session.clj:230)
at metabase.server.middleware.session$bind_current_user$fn__44978.invoke(session.clj:256)
at metabase.server.middleware.session$wrap_current_user_info$fn__44965.invoke(session.clj:216)
at metabase.server.middleware.session$wrap_session_id$fn__44951.invoke(session.clj:162)
at metabase.server.middleware.auth$wrap_api_key$fn__70290.invoke(auth.clj:27)
at ring.middleware.cookies$wrap_cookies$fn__83759.invoke(cookies.clj:216)
at metabase.server.middleware.misc$add_content_type$fn__34060.invoke(misc.clj:27)
at metabase.server.middleware.misc$disable_streaming_buffering$fn__34085.invoke(misc.clj:76)
at ring.middleware.gzip$wrap_gzip$fn__83801.invoke(gzip.clj:86)
at metabase.server.middleware.misc$bind_request$fn__34088.invoke(misc.clj:93)
at metabase.server.middleware.ssl$redirect_to_https_middleware$fn__83588.invoke(ssl.clj:38)
at metabase.server$async_proxy_handler$fn__80132.invoke(server.clj:71)
at metabase.server.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle(Unknown Source)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Error opening connection
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:244)
at org.sqlite.SQLiteConnection.(SQLiteConnection.java:61)
at org.sqlite.jdbc3.JDBC3Connection.(JDBC3Connection.java:28)
at org.sqlite.jdbc4.JDBC4Connection.(JDBC4Connection.java:21)
at org.sqlite.JDBC.createConnection(JDBC.java:115)
at org.sqlite.JDBC.connect(JDBC.java:90)
at metabase.plugins.jdbc_proxy$proxy_driver$reify__57460.connect(jdbc_proxy.clj:33)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at clojure.java.jdbc$get_driver_connection.invokeStatic(jdbc.clj:271)
at clojure.java.jdbc$get_driver_connection.invoke(jdbc.clj:250)
at clojure.java.jdbc$get_connection.invokeStatic(jdbc.clj:411)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:274)
at clojure.java.jdbc$db_query_with_resultset_STAR
.invokeStatic(jdbc.clj:1111)
at clojure.java.jdbc$db_query_with_resultset_STAR
.invoke(jdbc.clj:1093)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1182)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at clojure.java.jdbc$query.invokeStatic(jdbc.clj:1160)
at clojure.java.jdbc$query.invoke(jdbc.clj:1144)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invokeStatic(connection.clj:245)
at metabase.driver.sql_jdbc.connection$can_connect_with_spec_QMARK_.invoke(connection.clj:242)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invokeStatic(connection.clj:253)
at metabase.driver.sql_jdbc.connection$can_connect_QMARK_.invoke(connection.clj:249)
at metabase.driver.sqlite$fn__82485.invokeStatic(sqlite.clj:56)
at metabase.driver.sqlite$fn__82485.invoke(sqlite.clj:53)
at clojure.lang.MultiFn.invoke(MultiFn.java:234)
at metabase.driver.util$can_connect_with_details_QMARK_$fn__24608.invoke(util.clj:43)
at metabase.util$do_with_timeout$fn__6174.invoke(util.clj:354)
at clojure.core$binding_conveyor_fn$fn__5772.invoke(core.clj:2034)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
... 1 more
Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=x86_64, paths=[/org/sqlite/native/Linux/x86_64:/apps/apps/bin/sqlite-tools-linux-x86-3400100:/apps/apps/bin/clidriver/lib:/opt/teradata/client/17.10/lib64:/opt/teradata/client/17.10/tbuild/lib64:/opt/teradata/client/17.10/tdicu/lib64:/usr/lib/lib_64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
at org.sqlite.SQLiteJDBCLoader.loadSQLiteNativeLibrary(SQLiteJDBCLoader.java:389)
at org.sqlite.SQLiteJDBCLoader.initialize(SQLiteJDBCLoader.java:68)
at org.sqlite.core.NativeDB.load(NativeDB.java:63)
at org.sqlite.SQLiteConnection.open(SQLiteConnection.java:240)
... 33 more
2024-06-04 14:29:27,300 DEBUG middleware.log :: POST /api/database 400 60.9 ms (0 DB calls)
{:valid false, :dbname "Error opening connection", :message "Error opening connection"}

What version of metabase are you running? and how are you deploying metabase?

Also is this the first time you try to connect to sqlite? Can you run me through the process please

I'm using the latest jar file. This is the first time I'm trying to connect to sqlite.

This is my java version
openjdk version "1.8.0_152-release"
OpenJDK Runtime Environment (build 1.8.0_152-release-1056-b12)
OpenJDK 64-Bit Server VM (build 25.152-b12, mixed mode)

Thank you!

It looks like every time I try to "save changes" from the metabase admin screen, following files get created in /tmp

In case someone comes across a same issue, I was able to resolve it by setting the java temp directory

java -Djava.io.tmpdir=/your_directory -jar metabase.jar