1

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?

Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210

2 Answers2

4

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.

Carl Rosenberger
  • 910
  • 6
  • 12
1

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

Vagaus
  • 4,174
  • 20
  • 31
  • Hi!Yes, i know it's dangerous :) My application is an Internet Explorer add-in. When you open a "tab" in IE the add-in is loaded. When you open "another tab" it' s unable to connect to db. And then i used the method i described above, it's working but there are some problems.. – Ekin Ozcicekciler Nov 21 '10 at 08:09
  • Hi. I have never written IE addins but in this scenario I think that a much more reliable solution would be to create a separate process running a db4o in CS mode and connect to this process from each tab. When IE closes you can shoot this process dow. – Vagaus Nov 21 '10 at 13:27