Closed watersoft123 closed 6 months ago
I want to use sqlite-zstd to compress my sqlite db,now I have sqlite_zstd.so file for Android. how do I use "sqlite3_load_extension" to load sqlite_zstd.so extension? I'm not very familiar with Java. Could you provide an example?Thank you very much. Below is the Java code I am using; I am not very familiar with Java, but have not been able to successfully load the extension, so there may be some errors.
//load an extension private void loadExtension() { SQLiteConfig config = new SQLiteConfig(); config.enableLoadExtension(true); try { if (connection != null) { Statement stmt = connection.createStatement(); stmt.execute("SELECT load_extension('libsqlite_zstd')"); System.out.println("Extension '" + extensionName + "' loaded successfully."); } else { System.out.println("No connection to SQLite database. Cannot load extension."); } } catch (SQLException e) { System.out.println("Error loading extension '" + extensionName + "': " + e.getMessage()); } }
The issue has been resolved; it was a problem with the path of the so file.
I want to use sqlite-zstd to compress my sqlite db,now I have sqlite_zstd.so file for Android. how do I use "sqlite3_load_extension" to load sqlite_zstd.so extension? I'm not very familiar with Java. Could you provide an example?Thank you very much. Below is the Java code I am using; I am not very familiar with Java, but have not been able to successfully load the extension, so there may be some errors.
//load an extension private void loadExtension() { SQLiteConfig config = new SQLiteConfig(); config.enableLoadExtension(true); try { if (connection != null) { Statement stmt = connection.createStatement(); stmt.execute("SELECT load_extension('libsqlite_zstd')"); System.out.println("Extension '" + extensionName + "' loaded successfully."); } else { System.out.println("No connection to SQLite database. Cannot load extension."); } } catch (SQLException e) { System.out.println("Error loading extension '" + extensionName + "': " + e.getMessage()); } }