ZEOS in LAMW lazarus / 43-Android ---------------------------------------------------------------------- dseligo · 2024-07-22 08:11 For me it's very hard to work with components jSqliteDataAccess and jSqliteCursor, for multiple reasons (no parameters, case sensitive field names, 'eating' exceptions, problems with different SQlite versions on different phones, no compatibity with desktop database classes, ...). So I tried to access SQlite on Android with ZEOSdbo. I didn't install ZEOSdbo in Lazarus, I just unpacked it and set path in 'Other unit files (-Fu)' (to src\component, src\dbc, src\core, src\parsesql and src\plain). From SQlite's website I downloaded precompiled binaries for Android, and put libsqliteX.so file to 'assets' directory of project. First I tried to put it in 'libs\arm64-v8a', but app was immediately crushing. I didn't investigate further why so. To use libsqliteX.so first I saved it to file from assets: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const cLib = 'libsqliteX.so';var sPathData: String;...sPathData := GetFilePath(fpathData) + '/'; if not FileExists(sPathData + cLib) then  Asset_SaveToFile(cLib, sPathData + cLib); After that I set up connection and query: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  ZConn: TZConnection;  Query: TZQuery; ...   ZConn := TZConnection.Create(nil);  Query := TZQuery.Create(nil);  try    //ZConn.Database := GetFilePath(fpathDataBase) + 'test.db';    ZConn.Database := GetFilePath(sPathData) + 'test.db';    ZConn.Protocol := 'sqlite';    ZConn.LibraryLocation := sPathData + cLib;    ZConn.Properties.Append('ExtendedErrorMessage=1'); // show detailed errors    ZConn.Connected := True;     Query.Connection := ZConn;     Query.SQL.Text := 'select sqlite_version() AS sqlite_version';    Query.Open;    Result := Query.FieldByName('sqlite_version').AsString;   finally    Query.Free;    ZConn.Free;  end; One other thing: database path didn't work (GetFilePath(fpathDataBase)). I don't know why, so I used GetFilePath(sPathData). Versions used: Lazarus 2.2.4 (rev lazarus_2_2_4-0-g06a78ed923) FPC 3.2.2 x86_64-win64-win32/win64, ZEOS: 7.2.14 version. I am still testing, but for now it looks promising, and I am very happy. I would like to hear from other any thoughts or suggestions. I could prepare demo project if anyone is interested. I am especially interested why it doesn't work when libsqliteX.so is put in libs directory and why database can't be created in database directory. ---------------------------------------------------------------------- af0815 · 2024-07-22 08:30 There is a Forum for ZEOS itself, maybe there is more information about possibilities of ZEOS with Android. https://zeoslib.sourceforge.io/viewforum.php?f=50 For me the idea itself is very interesting. ---------------------------------------------------------------------- dseligo · 2024-08-07 17:32 Just an update. I am testing Zeos for a while know and everything works fine for now. Quote from: dseligo on July 22, 2024, 10:11:44 amOne other thing: database path didn't work (GetFilePath(fpathDataBase)). I don't know why, so I used GetFilePath(sPathData). I discovered that if I first create database with jSqliteDataAccess I could use it later with Zeos in 'fpathDataBase'. Probably some Android/Java stuff going on. Anyway, for now I first check if my DB exists, if not, I create it with jSqliteDataAccess, disconnect and after that work with Zeos. QuoteI am especially interested why it doesn't work when libsqliteX.so is put in libs directory I still didn't get this to work. I checked with logcat and it says it didn't find some class "org.sqlite.database.sqlite.SQLiteCustomFunction", but I have no clue what to do with that. Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 08-07 18:45:36.979 16841 16841 F mw.testrazno: java_vm_ext.cc:591] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception java.lang.ClassNotFoundException: Didn't find class "org.sqlite.database.sqlite.SQLiteCustomFunction" on path: DexPathList[[zip file "/data/app/~~y7ZR3DoN15qIvIpjEdVYfg==/org.lamw.t estrazno- 1VLPn2q1nQDIRDwBaMjDbQ==/base.apk"],nativeLibraryDirectories=[/data/ap p/~~y7ZR3DoN15qIvIpjEdVYfg==/org.lamw.testrazno- 1VLPn2q1nQDIRDwBaMjDbQ==/lib/arm64, /data/app/~~y7ZR3DoN15qIvIpjEdVYfg ==/org.lamw.testrazno-1VLPn2q1nQDIRDwBaMjDbQ==/base.apk!/lib/arm64- v8a, /system/lib64, /system_ext/lib64]]