Can I share an ObjectBox database (mdb files) between two Java applications

212 Views Asked by At

So I currently have a server running for an online game, and one of the ObjectBox boxes is for users, which holds things like email address, name etc.

I am just starting on a second game, and I want my users to be able to use the same set of info to log in to this one.

As both backends run on the same server (a VPS) I would love both Java apps, to be able to access the User box at the same time, rather than having duplicate data, which will be out of sync.

Is this possible?

UPDATE:

Both apps are java spark web servers, running in two diff docker containers, so the processes would be diff, and be using diff threads. I know the rough idea behind synchronized but not how to apply it, and not in the case of ObjectBox. Would I synchronise the BoxStore object? Or maybe the Box<T> ?

1

There are 1 best solutions below

3
On

Two processes cannot access the same data if they also write data. If only one process is writing, it might work, but I don't believe that limitation will work for your projects.

Another option is using ObjectBox Sync limited to the user entity. Here are some links to get you started: