B4J Question Add "wal" to an existing sqlite database

Discussion in 'B4J Questions' started by moster67, Jun 18, 2019.

  1. moster67

    moster67 Expert Licensed User

    I created a sqlite db in an external program in which I imported csv-files exported from an old Access97 database. Now I am using it with a B4J-server app.

    I just realized that there is only one file db-file now. The files related to "wal" are not present.
    I know that when creating the database within B4J, we can use
    sqlite.ExecNonQuery("PRAGMA journal_mode = wal")
    to add support.

    Is it possible to add support, like in my case, to an existing database?

    If not, I guess I will need to recreate everything from scratch (and from B4J) and then import the tables.
    Last edited: Jun 18, 2019
  2. Erel

    Erel Administrator Staff Member Licensed User

    Yes. It should work. What is the output of sqlite.ExecQuerySingleResult("PRAGMA journal_mode") ?
  3. moster67

    moster67 Expert Licensed User

    it says simply "delete"
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. moster67

    moster67 Expert Licensed User

    Created locally on Windows 10 and then moved to an Ubuntu server.
    According to this query,
    select sqlite_version();
    I am on 3.27.2 which I believe is among the latest ones.

    I believe I used "DB Browser for SQLite" to create the DB and import the tables. I will try to start over creating the DB from B4J and only then use the DB Browser for importing the tables.
  6. Harris

    Harris Well-Known Member Licensed User

    I always contend that SQLite was built for mobile devices. I suggest avoid using on servers.
    It (SQLite) works great on mobile (A and i).
    When trying to shoe-horn it into servers - problems arise (wal), such as this one.

    All my mobile devices use SQLite - and the servers (which receive data from mobile) use RDC (j) or some other method (many) to accept the data (MySQL, MSSQL,etc).
    Works perfect and no loss of hair - since that was lost many years ago on the head board!

    My 2 pesos...

  7. Erel

    Erel Administrator Staff Member Licensed User

    It depends. I run many "utility" servers and many of them use SQLite databases. It shouldn't be difficult to use wal mode.

    I agree that for production solution a database server with proper administration tools will be a better option.
  8. moster67

    moster67 Expert Licensed User

    I got eventually everything sorted by creating the DB in B4J and then importing the tables in DB Browser. It runs in Wal now.

    I am using the sqlite for sign ups to a newsletter so for this purpose it ought to be fine. Otherwise I also would use a more robust solution.
    Harris likes this.
  9. avalle

    avalle Active Member Licensed User

    I was able to activate wal from DB Browser for SQLite:
    1. Open the DB
    2. Select the Edit Pragmas tab
    3. Under the Journal Mode dropdown select WAL
    4. Click Save at the bottom right
  10. avalle

    avalle Active Member Licensed User

    And BTW I also use SQLite from multiple B4J server apps and I'm pretty happy with it
    Harris and OliverA like this.
  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