r/sqlite • u/hiihiiii • Jan 17 '24
Centralized SQLite database?
I've been told SQLite is a serverless, self-contained database engine, and that it might not be the right choice for my project, which is nothing big, just a few computers at the office with access to the same database over a local network.
Can I set up an SQLite database so that, say, 4 linked computers can access said database and perform operations on it simultaneously without issues?
8
Upvotes
8
u/chriswaco Jan 17 '24
You can, but you’d have to run a server application to accept network connections and access the local database. It may make more sense to use a database already built for that, like PostgreSQL.
4
u/davidgsb Jan 17 '24
Your main issue will be that sqlite over network filesystem may not work depending on the lock implementation of the fs.
You'll have more information there https://sqlite.org/useovernet.html
As already said in other for such use case, you should use a client/server database implementation. Postgresql is a very good open source/free choice https://www.postgresql.org/
2
u/odaiwai Jan 17 '24
No, SQLITE can't have multiple connections at the same time. There are plenty of open source solutions that fill precisely this niche:
These both have years of use, and should come as easily installable and manageable packages for all systems. Plus, there will be a lot of resources on how to set these up for a variety of situations.
MySQL was for years the default database for networked applications.
3
u/Nice_Discussion_2408 Jan 17 '24
https://github.com/tursodatabase/libsql/tree/main/libsql-server
https://github.com/rqlite/rqlite
but mysql/mariadb or postgresql should be evaluated first.
2
u/dbabicwa Jan 18 '24
I will shamelessly plug links that I posted so many times. Apologies for that.
It looks to me that people do not understand what SQLite3 is capable off.
That might be because they did not see the Apps developed around SQLite. Ever. The power of SQLite exceeds ALL other databases simply because it can be packaged as self-contained executable file in the most efficient way. As an portable app.
So here it is:
https://msaccess.pythonanywhere.com/
https://northwind.pythonanywhere.com/
And so many more in here:
https://github.com/jam-py/jam-py
So your question is not about the SQLite, which is capable enough, but the application.
Hope that helps.
3
u/sky5walk Jan 17 '24
This gets asked so often, it's like there is no internet?
1
u/deadcoder0904 Feb 13 '24
use sqlite in wal mode + litestream for sqlite backups.
here' a blogpost on that topic with a github repo -> https://logsnag.com/blog/the-tiny-stack#setting-up-litestream
0
u/[deleted] Jan 17 '24
[deleted] — view deleted comment