Why can't I use the same db4o file from multiple connections?
-
26-09-2019 - |
Question
I'm just connecting to a db4o database file from 2 different connections with the LockDatabaseFile=false
configuration value.
When I store an object from an IObjectContainer, I'm unable to get that object from the other IObjectContainer at the same time. I commit the transaction after Store but still I'm unable to get that object immediately from the other active IObjectContainer.
What is the problem?
Solution
db4o is not designed to allow opening a database file in write mode multiple times. With what you are doing you will corrupt the database file. Please use Client/Server mode instead.
OTHER TIPS
First, let me say that this option is dangerous. It allows two (or more) applications to change the db file at the same time: corruption almost guaranteed.
If I understood it correctly, you have 2 'client' applications that opens the database (using OpenFile()), right?
Have you tried to use CS mode?
How are you checking the object existence? Using a query? (how your query looks like?)
How does your configuration looks like?
Best