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

Maven and db4o dependency

I'm intrigued to test new frameworks in the Java world, and decided to create a new project that takes advantage of Maven and db4o. I'm starting to get a hang of Maven, but I have a hard time adding db4o as a dependency to the project. First problem…
Jens Jansson
  • 4,626
  • 4
  • 25
  • 29
6
votes
3 answers

Looking for guidance on embedded .NET database (such as db4o, NHibernate, or RavenDB)

I have an object model that I want to store using an embedded database. I have so far been looking at db4o, NHibernate to SQLCE (w/ linq), and RavenDB. This would be used in a desktop C# application. The key features I am looking to leverage are:…
David B
  • 117
  • 1
  • 8
5
votes
2 answers

How does db4o instantiate objects?

What mechanism does db4o use to instantiate stored objects ? My class isn't Serializable and doesn't provide zero argument constructor and the only constructor throws NullPointerException when it's argument is null. In spite of that, db4o can still…
Łukasz Bownik
  • 6,149
  • 12
  • 42
  • 60
5
votes
1 answer

db4o: Same class, different java projects

I have two different Java Applications A and B. They should use the same Database for user management (If the User has an account in Application A, he also has an account in Application B and vice versa). Both Application A and B have exactly the…
jcborges
  • 1,064
  • 2
  • 10
  • 13
5
votes
2 answers

What is the best object lifetime strategy for Redis in web application

I will plan to use Redis (ServiceStack) as whole database for web application. I can insert 76000 records in 7.4 seconds. But using single connection (RedisClient object-life-time is Application), I used Set generic method not Store (huge…
5
votes
2 answers

How to store objects created in IronPython to object databases

I'd like to use object database to persist some classes created in IronPython. The database is db4o for .NET 2.0 (downloaded today). The code looks like this: import…
stej
  • 28,745
  • 11
  • 71
  • 104
5
votes
1 answer

linq to Db4o not using index

I'm trying db4o and i'm having bad performance when using linq to db4o. (using 7.12) Here is my configuration : var configuration = Db4oFactory.Configure(); …
Yann
  • 1,388
  • 2
  • 11
  • 9
4
votes
4 answers

Any competitors to db4o on compact framework?

We've been trying db4o for persisting objects on the compact framework. It works very well from our tests so far. However, it appears they are on the expensive side for small startups with minimal units needed. Does anyone know of any similar…
MrJeepster
4
votes
1 answer

Why does the StringComparison.InvariantCultureIgnoreCase not work with this Db4o linq query?

The following query works. I get the correct result back when I enter the name with a wrong casing. private static IObjectContainer db = Db4oFactory.OpenFile(db4oPath); public static IQueryable GetCompaniesByName(string name) { …
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
4
votes
1 answer

How do I combine usage of db4o to store data and Lucene to index data for fast search?

I'm new to both db4o and Lucene. Currently I'm using db4o to persist my data on an Android app. I need the capability to perform quick searches, as well as provide suggestions to the user (e.g., auto complete suggestions). An SO poster mentioned…
Soumya Simanta
  • 11,523
  • 24
  • 106
  • 161
4
votes
1 answer

ClassCastException in DataNucleus DAO object when persisting/retrieving an Object using JDO

I've created a simple webapp using Spring & Jetty, and am creating a hello world JDO test using DataNucleus & DB4O. I can persist a class no problem, but when I go to query for the class I get a ClassCastException, can't cast a.b.c.MyClass to…
David Parks
  • 30,789
  • 47
  • 185
  • 328
4
votes
2 answers

How to avoid Duplicate objects in DB4o database

Student s1 = new Student(); s1.rollNo = "44"; s1.name = "kk"; db4o().save(s1); Student s2 = new Student(); s2.rollNo = "44"; s2.name = "kk"; db4o().save(s2); here I am saving two object s1 and s2 in DB4o Database…
44kksharma
  • 2,740
  • 27
  • 32
4
votes
1 answer

Is DB4O Replication faster than SQL Server Merge Replication?

Does the replication system that comes with DB4O work well? Basically I would like to know if anyone has some good numbers on the record throughput of their replication system and if it handles concurrency errors gracefully or not. What is the…
Mark Ewer
  • 1,835
  • 13
  • 25
4
votes
3 answers

Example websites using db4o

I'm very impressed with my initial tests with db4o. However, i'm wondering just how many enterprise class websites are out there powered by db4o, i couldn't see any on the main website? I can't see any reason why db4o should not be used. There…
Keith Patton
  • 938
  • 5
  • 12
4
votes
4 answers

Querying by type in DB4O

How do you pass a class type into a function in C#? As I am getting into db4o and C# I wrote the following function after reading the tutorials: public static void PrintAllPilots("CLASS HERE", string pathToDb) { IObjectContainer db =…
Faizan S.
  • 8,634
  • 8
  • 34
  • 63
1
2
3
25 26