Click here to Skip to main content
16,004,587 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a legacy windows software that writes to an SQLlite3 database. I need to read this database and present the data on a web application or android app dashboard after some calculation. The reading from the database should be triggered whenever the legacy software writes on it. i.e. we need live data from the database to be presented on the tablet app. the tablet is android, that app could be native android app or PWA or even else.

I can install anything on the windows machine (windows10, Bit64) The table will be on the same LAN The legacy software get the data from some sensors and write it into it's .db3 file.

what is the best or possible approach to build a solution?

I expect the mobile app or web app displaying the data needed in a nice dashboard instantly.

What I have tried:

Not much, just tried to brows the database using some SQL tools. the database contains location coordinates that need to be displayed on a 2D graph.
Posted
Comments
Richard MacCutchan 12-Sep-24 7:53am    
You can get information out of the database quite simply with an SQLite client (.NET and Android both have one). What you do from then on is a different issue.
Firas FRAXNET 12-Sep-24 15:32pm    
Thank you

SQLite operates on a local filesystem, therefore the Android host cannot query the SQLite database without access to the Windows machine's filesystem.

The optimal solution would be creating a simple RESTful interface that runs on a web server on the Windows machine and allows the SQlite data to be queried via an HTTP call on the Android.

If you'd rather not write such an interface yourself, a web search of sqlite to restful api yields several existing options you could use.
 
Share this answer
 
Comments
merano99 yesterday    
+5 A REST API is an uncomplicated and relatively easy to implement with Python.
To meet the requirement where a Windows application writes sensor data into a SQLite database and an Android tablet needs to be notified of new data and display it graphically, there are several possible approaches.

Since SQLite is serverless, it is not well-suited for parallel access from multiple devices (such as Windows and Android). A centralized database system (like MySQL or PostgreSQL) would be a better option, as these are designed to handle concurrent access from different devices. If it is possible to modify the legacy program that writes sensor data into the SQLite database, this would be the best and most sustainable long-term solution.

If the legacy program does not use transactions, SQLite is not ideal for parallel access, since it only allows one write operation at a time. However, if all access were to occur within transactions, concurrent read access could happen without conflicts, with only one write operation allowed at a time.

If the legacy program cannot be modified and does not already use transactions, migrating to another database system could be challenging. An alternative would be to monitor the SQLite database file. Once a change is detected, another program could place a shared lock (which SQLite supports by default), allowing multiple programs to read simultaneously while blocking write operations. The reaction of the legacy program to a locked SQLite database depends on its implementation. If the lock does not last too long, this could be a workable solution.

The program that monitors the database could notify the Android tablet when data changes and send the necessary data. This could be done directly or by buffering the data via a web server. A possible implementation could be done relatively easily using Python.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900