B4J Question Raspberry Pi SQLite Files WAL & SHM not created

rwblinn

Well-Known Member
Licensed User
Hi All,

on a Raspberry Pi a SQLite webapp is running. During start, the database is created if not found BUT both sqlite db-wal and db-shm files are not created. Running the same webapp under Windows 8.1, both files are created. On the RPi SQLite 3.7.13 is running.

This is the code to create the files:
B4X:
...
    If gSQL.ExecQuerySingleResult( _
        "SELECT count(name) FROM sqlite_master WHERE type='table' AND name='" & TblScribblesName & "'") = 0 Then
            'best mode for multithreaded apps.
            gSQL.ExecNonQuery("PRAGMA journal_mode = wal")
            ' Add the columnname and type to the columns map
            For i = 0 To TblScribblesColCount - 1
                columns.Put(TblScribblesColNames(i), TblScribblesColTypes(i))
            Next
            DBUtils.createTable(gSQL, TblScribblesName, columns, TblScribblesColNames(0))
            AppLog("> Created Table: " & TblScribblesName)
    End If
...
Any hint(s) appreciated.
Rob
 
Last edited:

billzhan

Active Member
Licensed User
try
B4X:
sudo java -jar yourjar.jar
'if using b4j-bridge
sudo java -jar /home/b4j-bridge.jar
 

rwblinn

Well-Known Member
Licensed User
Hi billzhan,

thanks for help = did try that indeed as well - but files are not created. Will explore further.

For those interrested in this B4J HowTo Project, download here.
This B4J webapp shows the usage of jQuery Mobile (jQM) Widgets NavBar, ListView, Pages and Buttons.
Read scribbles.b4j, scribbles.bas and www/index.html for detailed information.
It runs so far fine on a RPi. Still working on exploring how to improve jQM NavBar behaviour on some mobile devices.
 

Erel

Administrator
Staff member
Licensed User
@rwblinn have you find a solution for this?

I'm using this code:
B4X:
sql.ExecNonQuery("PRAGMA journal_mode = wal") 'best mode for multithreaded apps.
Log("journal mode: " & sql.ExecQuerySingleResult("PRAGMA journal_mode"))
It returns "delete". This means that it failed to set the jounral mode to wal.

My guess is that the file system doesn't support this mode.
 

rwblinn

Well-Known Member
Licensed User
Hi Erel,

Running
B4X:
Log("Connect to the Database...")
sql.InitializeSQLite(File.DirApp, DatabaseFile, True)
Log("Set the journal mode...")
sql.ExecNonQuery("PRAGMA journal_mode = wal") 'best mode for multithreaded apps.
Log("journal mode: " & gSQL.ExecQuerySingleResult("PRAGMA journal_mode"))
Results
On Windows: using sqlite-jdbc-3.8.6, 3.8.7, 3.8.10.2 and 3.8.11.1 results in Journal Mode = wal and the additional files are created.
On Raspberry Pi:
using sqlite-jdbc-3.8.6 and 3.8.7 results in Journal Mode = wal, but the additional files are NOT created.
using sqlite-jdbc-3.8.10.2 and 3.8.11.1 results in application crashes:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V

Thanks for coming back on this.
 
Top