B4J Question sqlite wal mode on Mac OS X

Discussion in 'B4J Questions' started by xulihang, Sep 25, 2018.

  1. xulihang

    xulihang Active Member Licensed User

    Hi,

    My app uses keyvaluestore and I have enabled the wal mode for faster loading speed and multithread reading by add the code below in keyvaluestore's initialize sub:

    Code:
    sql1.ExecNonQuery("PRAGMA journal_mode = wal")
    It works well in windows, but crashed in OS X. I got this error:

    Code:
    java.sql.SQLException: [SQLITE_NOTADB]  File opened that is not a database file (file is encrypted or is not a database)
        at org.sqlite.DB.newSQLException(DB.java:
    383)
        at org.sqlite.DB.newSQLException(DB.java:
    387)
        at org.sqlite.DB.throwex(DB.java:
    374)
        at org.sqlite.NestedDB.prepare(NestedDB.java:
    134)
        at org.sqlite.DB.prepare(DB.java:
    123)
        at org.sqlite.Stmt.execute(Stmt.java:
    113)
        at anywheresoftware.b4j.objects.SQL.ExecNonQuery(
    SQL.java:156)
        at b4j.example.keyvaluestore._createtable(keyvaluestore.java:
    62)
        at b4j.example.keyvaluestore._initialize(keyvaluestore.java:
    357)
        at b4j.example.tm._initialize(tm.java:
    1342)
        at b4j.example.project._initializetm(project.java:
    706)
        at b4j.example.project._open(project.java:
    826)
        at b4j.example.main._menubar1_action(main.java:
    487)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
    62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    43)
        at java.lang.reflect.Method.invoke(Method.java:
    498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    90)
        at anywheresoftware.b4a.BA$
    1.run(BA.java:215)
        at com.sun.javafx.application.PlatformImpl.lambda$
    null$173(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$
    174(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$
    Future.run(InvokeLaterDispatcher.java:95)
    Database created by OS X works fine. But sqlite is not in wal mode.

    I have attached the database created under windows.
     

    Attached Files:

  2. xulihang

    xulihang Active Member Licensed User

    I solved it. It is the upstream sqlite-jrdc's problem. I downloaded the latest jar from here:download, and it works on Mac.
     
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice