Questions tagged [db4o]

db4o is an open source embeddable object database for Java and .NET.

As of October 2014 Versant has discontinued the work on db4o due to a decision by Actian, which is the new owner of Versant.

db4o is an simple to use yet powerful object database. It is designed for embedded scenarios and runs on the Java and .NET platform.

You just drop db4o's single programming library (.jar /.dll) into your development environment, open a database file and store any object - no matter how complex - with just one line of code, e.g., in Java:

public void store(Car car) {
  ObjectContainer db = Db4oEmbedded.openFile("car.yap");
  db.store(car);
  db.close();
}

This unmatched ease-of-use results in drastically reduced development time.

Rather than using string-based APIs (such as SQL, OQL, JDOQL, JPAQL, and SODA), Native Queries allow developers to simply use the programming language itself (e.g., Java, C#, or VB.NET) to access the database and thus benefiting from compile-time type checking, the full expressive power of OO-languages, and the great convenience of advanced development environments.

For example, compare this Native Query in C# for .NET 3.5:

IList<Student> students =
  from Student student in container
  where student.Age < 20 && student.Grade == gradeA
  select student;

... or in Java:

List<Student> students = database.query<Student>(new Predicate<Student>() {
  public boolean match(Student student) {
    return student.getAge() < 20 && student.getGrade().equals(gradeA);
  }
});

As you can see, Native Queries eliminate all strings from queries – they are 100% type-safe, 100% refactorable, and 100% object-oriented.

The same concept applies to our LINQ provider which allows you to smoothly move between Relational db and db4o, for a truly complimentary combination. db4o allows using all the constructs of Microsoft’s Language Integrated Queries (LINQ). db4o LINQ syntax is provided for .NET developers and aimed to make writing db4o code even more native and effortless.

Queries like this:

IEnumerable<Pilot> result =
  from Pilot p in container
  where p.Name.StartsWith("Michael") && p.Points > 2
  select p;

…are perfectly valid within db4o.

Another way to load objects from the database is to use the lazy transparent activation pattern. Suppose you already have the object 'c' of type Car; then you can get the pilote like this:

Pilot p = c.getPilot();

…all Pilote attribute are by db4o as you need them.

Resources:

380 questions
2
votes
1 answer

Saving images or pdfs in db4o

I know it is not a good thing to save files in a relational databas. But how about in a objectdatabase? Is it still a bad idea or are they more adapted for this kind of operations?
Fred
  • 1,129
  • 1
  • 14
  • 35
2
votes
1 answer

Trouble with db4o...objects aren't returned after an IIS reset/container is out of scope

So I'm probably doing something tragically wrong with db4o to cause this issue to happen...but every time I reset my context I lose all of my objects. What I mean by this is that as soon as my container object goes out of scope (due to an IIS reset…
JC Grubbs
  • 39,191
  • 28
  • 66
  • 75
2
votes
2 answers

Db4o - refresh ALL new objects in persistent session

is it possible in Db4o to load new objects into persistent IObjectContainer? I have a desktop application which opens one connection (IObjectContainer) when started. if I query all objects with: var objects = from DummyClass foo in session …
Tomas Panik
  • 4,337
  • 2
  • 22
  • 31
2
votes
2 answers

Storing an object containing a Calender object in a db4o local database, cannot retrieve object fields

I have been storing an object which contains a GregorianCalendar object in a db4o database, which works just fine. However, on retrieving the object (after closing and re-opening the database), I cannot seem to access some of the information inside…
2
votes
3 answers

db4o on Honeycomb Db4oException: File format incompatible

I'm using db4o in a small project that works great on Android 2.2, 2.3, etc. On Honeycomb, however, database initialization results in the following error: com.db4o.ext.Db4oException: File format incompatible:…
Rockmaninoff
  • 3,573
  • 5
  • 34
  • 35
2
votes
1 answer

db4o Tranparent Persistence doesn't store later objects in my own ActivatableCollection

I'm rolling my own ActivatableCollection for db4o but cribbing heavily from the builtin ActivatableList implementation. I'm running into the problem where transparent persistence doesn't seem to be working correctly. In the test code…
Ants
  • 2,628
  • 22
  • 35
2
votes
2 answers

db4o How to rename class via configuration

I am using db4o in two seperate projects that share the same classes but not the same .dll . I am fixing this so that they share the same .dll but I need to rename the classes. According to the documentation you set up configuration and open the db…
runxc1 Bret Ferrier
  • 8,096
  • 14
  • 61
  • 100
2
votes
1 answer

copying the db4o file doesn't copy the data in it

I have a db4o file with data in it, when i try to copy the file to another project, the data gets empty ? what is the reason behind it ? Can some one explain it to me ? Thanks in anticipation
Sreedhar Danturthi
  • 7,119
  • 19
  • 68
  • 111
2
votes
1 answer

db4o - count number of total records in database?

I am using db4o and was wondering, how can I get the total number of objects in the database? There isn't an explicit way using the API; however, I can write a query to simply count all the objects, but I was hoping for a more direct way to do…
Walter
  • 1,290
  • 2
  • 21
  • 46
2
votes
2 answers

DB4O scalability

I'm looking for information about DB4O object database. I know it has client/server mode, but I have no idea how scalable it is. I'm a big lover of object db idea, but still couldn't find an appropriate OODB to use in any of my projects. So my…
Davita
  • 8,928
  • 14
  • 67
  • 119
2
votes
4 answers

Is NoSQL the best option for this specific database problem

I have a problem and I think a NoSQL solution is the answer but I am not sure. Also, I am not sure what type of NoSQL DB (Object,Document,Graph,Key,etc) would be best suited to solve this problem. Problem: I have two collections. CollectionA…
detroitpro
  • 3,853
  • 4
  • 35
  • 64
2
votes
1 answer

How do you exclude a property in a persistent object in db4o using C#?

Since "[Transient]" does not really work on properties. What do I do now?
LEMUEL ADANE
  • 8,336
  • 16
  • 58
  • 72
2
votes
1 answer

Implement a relation using db4o

For testing purposes i want to implement a relationship between two java classes for instance student and exam. How can i make relationships using db4o. I don't have much experience with this DB - system, just worked with hibernate so far.
SmokedMeat
  • 48
  • 5
2
votes
1 answer

db4o SODA compare field values

class SomeClass { private DateTime fieldA; private DateTime fieldB; } Using SODA, what is the proper way to select all objects whose fieldA is greater than fieldB? Something like this? var query =…
Travis Heseman
  • 11,359
  • 8
  • 37
  • 46
2
votes
2 answers

db4o viewer - Java / Linux

I need a db4o viewer for a Linux box running Java. I noticed this post was for a .net client, but I don't have Windows and don't intend to. Is there something I can use? I checked out some projects, but they look like they haven't released any…
Walter White