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
2 answers

How can I control cache of the DB4O

I have some difficulties to find documents about DB4O. How can I control cache of the DB4O? I think than its connection is expending all memory of our server. I want set the minimal cache configuration. Could anyone recommend me some document or…
2
votes
1 answer

Mysql to Mysql - Hibernate replication using db40/drs?

I would like to do Mysql to Mysql replication using drs. Is it possible to do the same without storing data in db4o? I just want to use drs replication using Hibernate. Any positive/negative experience with drs?
Sundar
  • 1,204
  • 1
  • 14
  • 17
2
votes
1 answer

Getting Db4o blobs out of the Database without storing them to disk

Is there a way to get a Db4o Blob out of the Database without storing it to disk? I only found the method void com.db4o.types.Blob.writeTo(File arg0)
AntonS
  • 700
  • 1
  • 6
  • 23
2
votes
1 answer

Replacing a db4o stored object with an instance of a subclass

I want to change all objects that match a condition to use a specific/new subclass. There are no other subclasses being used with the stored objects, so its in all cases a change from the base class to its subclass. In order to keep all references…
eglasius
  • 35,831
  • 5
  • 65
  • 110
2
votes
2 answers

Coming from a relational database background, how should I model relationships in db4o (or any object database)?

I'm experimenting with db4o as a data store, so to get to grips with it I thought I'd build myself a simple issue tracking web application (in ASP.NET MVC). I've found db4o to be excellent in terms of rapid development, especially for small apps…
Mark Bell
  • 28,985
  • 26
  • 118
  • 145
2
votes
3 answers

What is causing this DatabaseFileLockedException when trying to open a db4o database in an ASP.NET MVC app?

I'm building a small web application with ASP.NET MVC 2, using db4o as a datastore. I have added an HttpModule—as per the example here—to give the application access to the db4o database, and everything is working perfectly on my development machine…
Mark Bell
  • 28,985
  • 26
  • 118
  • 145
2
votes
1 answer

db4o: compacting / shrinking

Does anyone know of a way to shrink/compact a db4o database?
NinjaCat
  • 9,974
  • 9
  • 44
  • 64
2
votes
2 answers

How to stores and Pictures in Db40?

I want to stores fotos use DB4o and a tried de following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using…
2
votes
1 answer

How do you do data management tasks in a Db4o Object Database?

I'm new to OODBMS systems, but I'm using Db4o on a new project for which it's perfectly suited. Things are going great and I really like the concept, but I'm struggling with how to do basic data management tasks associated with development. …
JC Grubbs
  • 39,191
  • 28
  • 66
  • 75
2
votes
2 answers

Is it OK to open a DB4o file for query, insert, update multiple times?

This is the way I am thinking of using DB4o. When I need to query, I would open the file, read and close: using (IObjectContainer db = Db4oFactory.OpenFile(Db4oFactory.NewConfiguration(), YapFileName)) { try { List pilots =…
Kevin Le - Khnle
  • 10,579
  • 11
  • 54
  • 80
2
votes
2 answers

how to design the query for non-sql database

can anyone give some reference for non-sql database query interface design pattern? For sql-based database, the query can be achieved by combining the query token. but for non-sql, how to design the query, given that the query could be very…
Benny
  • 8,547
  • 9
  • 60
  • 93
2
votes
2 answers

Is anyone aware of an Object Manager Enterprise plugin for Visual Studio 2010?

I'm using DB4O on a new project I'm playing with and it would help me no end if I was able to use the Object Manager Enterprise utility. I understand it's only available as a VS plugin, so does anyone know whether such a plugin is / will be…
Phil.Wheeler
  • 16,748
  • 10
  • 99
  • 155
2
votes
1 answer

Setting unique key constraint for Db4oEmbedded EmbeddedConfiguration

I want to set unique key constraint for Db4oEmbedded EmbeddedConfiguration. Here goes my code: EmbeddedConfiguration myConf =…
Viet
  • 17,944
  • 33
  • 103
  • 135
2
votes
1 answer

How to install and use db4o for Android?

I have to admit that I'm new to Java and Android. db4o seems to be an excellent DB framework to replace SQLite http://developer.db4o.com/Platforms/Java/Android.aspx. I want to use it for my Android application. I don't know how to:…
Viet
  • 17,944
  • 33
  • 103
  • 135
2
votes
1 answer

Db4o Mvc Application Architecture

I am currently testing out Db4o for an asp.net MVC 2 application idea but there are a few things I'm not quite sure on the best way to proceed. I want my application to use guessable routes rather than Id's for referencing my entities but I also…
Scott Mackay
  • 1,194
  • 10
  • 34