Access sqlite from a remote server

前端 未结 8 1159
悲哀的现实
悲哀的现实 2020-11-28 15:05

I am wondering how i can access an sqlite database that is sitting a remote server.I have read threads discouraging it but i need to do it if its possible.

          


        
相关标签:
8条回答
  • 2020-11-28 16:01

    sqlite is a document database meaning that its pretty much just a flat file store of your data with only the most minimal database engine on top, that is why it is like 300kb total. What you can do as a solution is to copy the db from your remote location to your location via ftp or access it by assigning a network share location to it. Be warned though that only 1 user can write to sqlite at a time.

    0 讨论(0)
  • 2020-11-28 16:02

    you can consider switching to PostgreSQL instead of SQLite, the database manipulation is very similar. The little differences in handling primary keys etc you can google. For example in the INSERT statement you'd pass a NULL in SQLite, as a primary key and in Postgre you'd pass it as DEFAULT (given you want the database to create the key for you).

    In Python3 for example, the code difference I know of is that PostgreSQL allows remote connection and that avoiding SQL injection syntax is slightly different, as SQLite3 way would be with ? and PostgreSQL9.5 would be with %s

    Switching to Postgre would provide you a remote connection possibility and it is a definite step up from using a local database (which is only designed for small to medium bandwidth applications).

    0 讨论(0)
提交回复
热议问题