SQLite over a network

坚强是说给别人听的谎言 提交于 2019-12-25 08:32:38

问题


I am creating a Python application that uses embedded SQLite databases. The programme creates the db files and they are on a shared network drive. At this point there will be no more than 5 computers on the network running the programme.

My initial thought was to ask the user on startup if they are the server or client. If they are the server then they create the database. If they are the client they must find a server instance on the network. The one way I suppose is to send all db commands from client to server and server implements in the database. Will that solve the shared db issue?

Alternatively, is there some way to create a SQLite "server". I presume this would be the quicker option if available?

Note: I can't use a server engine such as MySQL or PostgreSQL at this point but I am implementing using ORM and so when this becomes viable, it should be easy to change over.


回答1:


Here's a "SQLite Server", http://sqliteserver.xhost.ro/, but it looks like not in maintain for years.

SQLite supports concurrency itself, multiple processes can read data at one time and only one can write data into it. Also, When some process is writing, it'll lock the whole database file for a few seconds and others have to wait in the mean time according official document.

I guess this is sufficient for 5 processes as yor scenario. Just you need to write codes to handle the waiting.



来源:https://stackoverflow.com/questions/23008357/sqlite-over-a-network

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!