Accessing J-Pilot Data From Mobile And Web
In SQL Datamodel For J-Pilot I described a SQLite based datamodel for J-Pilot. This SQLite based storage is now reality with
- J-Pilot Plugin For SQLite Export which describes a plugin for J-Pilot, which allows to write data out to SQLite, still keeping the internal Palm data format, and therefore still being able to hot-sync
- SQLite Storage for J-Pilot which enables J-Pilot to read and write its data entirely to and from SQLite. The internal Palm data format is no longer used, hot-syncing to any Palm devices is therefore no longer possible
As all my Palm devices no longer work I use variant #2, i.e., I start J-Pilot exclusively in the SQLite-only mode. This is the command I use:
-S (capital S) uses SQLite exclusively. Option
-p skips loading plugins, as I do no longer any J-Pilot plugin. Option
-r suppresses the writing to the
In Testing J-Pilot feature-gtk3 branch I sketched the possibility to run J-Pilot in the browser. This is a feature of GTK+ 3. Although it looks cool, it is not really fast, and doesn't really feel like a web-app.
I now implemented a simple PHP application, which uses the SQLite data from J-Pilot and allows the following:
- searching in address, databook, to-do's, memos
- editing above entities, i.e., modify, delete, or insert
1. Usage. Search screen looks like this:
In above search-screen you can either search for some string, or specify a specific date, which you want to inspect. If you specify a date then only datebook entries for that date are shown. So to say, it is a poor-man's date view.
Search results show as below.
Clicking on one those entries shows the edit-screen:
2. Prerequisites on Android. On Android you need the Termux app. Any other terminal app should do as well. But Termux is probably the best Android app so far. First update to the latest packages:
Then install PHP and composer:
pkg install php composer
It will also install a number of dependent packages.
I recommend to allow Termux to run continously in the background. You allow this via Android system settings.
Also, I recommend to create an icon on the home-screen, so that you can easily access your J-Pilot data. In Brave you do it like this.
This then looks like this.
3. Installation on Android. Create a directory called
php. It is not required, you can have the installation stored anywhere. Install the app via composer:
mkdir php cd php composer create-project eklausme/jptables
This will create a directory
jptables, which contains all PHP source code. Now copy
jptables.db file to this directory. Attention: You have to
jptables.db to 666, otherwise it cannot be edited. Then start via:
php -S localhost:8000 -t . 2>php.log &
Now start a browser and use the URL: http://localhost/jptables/jpsearch.php.
In case you installed the app somewhere else, then change
jptop.php accordingly. In that file the location of
jptables.db is configured. The line is question is:
$dbpath = ($home ? $home : '/home/yourUserId') . '/php/jptables/jptables.db';
4. Other platforms. On iOS you can use phpwin. On OSX PHP is supported, see Installation on macOS.
5. Limitation. When you run this PHP-internal web-server then potentially all other apps on that particular smartphone can read your data. Though, no other smartphone or PC can read the data, as the web-server just serves