Hive: Using Hive in a Flutter program shared on the Windows network

Created on 5 Jan 2021  路  1Comment  路  Source: hivedb/hive

  • Sorry my english, this isn't my firt language

Question

I'm using Hive in a Flutter Desktop app, but I want to use it on multiple stations, using the same bank. For each station I open the application, it creates new database files in the default directory of each machine, in Documents.

Would there be any solution or other database alternative?

Version

  • Platform: Windows
  • Flutter version: 1.26.0-1.0.pre
  • Hive version: ^1.4.4+1
question

Most helpful comment

File databases (SQLite, Hive, ..) is not suitable to be used by multiple clients.

  1. Filesystem locks files when an application reads or writes to the file
  2. Even if you've managed to unlock the file you'll probably face with race condition issues. (When multiple applications tries to write data into database at the same time the data could be merged which will invalidate frame data or you might get weird OS errors).

I would suggest well known network based database systems for example: mysql, postgresql, mongodb, redis, etcd, ... They are supporting and already optimized for concurrent client connections.

Also there's usually a layer between client and database, called backend to protect resources. It's not required but you might need to add that layer if things become complicated. Dealing with APIs would be much easier on client side rather than databases, but will increase development time significantly because you have to write backend code.


Btw if dart is the only language you know, you can use dart to create http server and handle & respond to requests using data from hivedb. ref: Dart http server

>All comments

File databases (SQLite, Hive, ..) is not suitable to be used by multiple clients.

  1. Filesystem locks files when an application reads or writes to the file
  2. Even if you've managed to unlock the file you'll probably face with race condition issues. (When multiple applications tries to write data into database at the same time the data could be merged which will invalidate frame data or you might get weird OS errors).

I would suggest well known network based database systems for example: mysql, postgresql, mongodb, redis, etcd, ... They are supporting and already optimized for concurrent client connections.

Also there's usually a layer between client and database, called backend to protect resources. It's not required but you might need to add that layer if things become complicated. Dealing with APIs would be much easier on client side rather than databases, but will increase development time significantly because you have to write backend code.


Btw if dart is the only language you know, you can use dart to create http server and handle & respond to requests using data from hivedb. ref: Dart http server

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxim-saplin picture maxim-saplin  路  3Comments

Hopheylalal picture Hopheylalal  路  4Comments

kthecoder picture kthecoder  路  3Comments

yaymalaga picture yaymalaga  路  4Comments

sergiyvergun picture sergiyvergun  路  4Comments