Is it possible to set SQLite DB on server and connect to it in an Android app

androidsqlite

I'm creating an app as a study project. One of requirements is not to hardcode. For this reason, I want to get data from DB with every start of the app and change data stored in DB outside of the app code. I wanted to use Redis and store data in JSON at first, but there were too many problems, because Redis doesn't work with Android by default.

So, the question is: is it possible to use SQLite set on server? I know that this DB is not supposed to work in client-server mode, but I have found out some SQLite hostings in the Internet. If it is possible, how to perform it? If not, which way should I store data? SQL format is pretty convenient for me, because it is literally a table.

Best Answer

No, it's not possible. SQLite is an embedded database engine, which means it runs as part of your program and uses a file (usually) in the application sandbox on Android (so this is not part of your source code).

SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files.

It's probably possible to have an application run on a server which is able to function as a backend for your app and stores its data in a SQLite file, but I'd rather choose a database which is intended for this kind of purposes like PostgreSQL or MySQL. You can talk SQL to those databases too. Of course, in a production-grade application you'll need an application as a back end, not just a database, which is able to authenticate users, validate business logic etc.

Related Question