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
-1
votes
1 answer

Why i get DatabaseClosedException(DB4o) trying to insert/delete/show 2 times in one run?

Im getting this exception when i try to manipulate more than one objects in the DB in one run. No matter what choice i choose the same problem happens again and again. It seems that is related that the connection gets disconnected in some point that…
Lluis
  • 23
  • 5
-1
votes
1 answer

db4o - weird characters when retrieving objects

import java.io.File; import com.db4o.Db4o; import com.db4o.Db4oEmbedded; import com.db4o.ObjectContainer; import com.db4o.ObjectSet; import com.db4o.query.Query; public class Student { private String name; public AlumnoBDOO(String name){ …
seRgiOOOOOO
  • 91
  • 2
  • 2
  • 8
-1
votes
1 answer

Java : Store and retrieving image in db4o

I want to store and retrieving image in db4o with java I have read some topic about store image in db4o but i can not do I have db ; class WaterFish { String fishname; String biology; String information; Fish_Image image ; …
duythanhcn
  • 31
  • 1
  • 3
-1
votes
4 answers

Java Dates Format

I am having trouble formatting date in java. I have a shopping class that has item name in string, quantity in int and a date in Date. In the run class I am trying to run this query. Date date = new Date(202020); SimpleDateFormat dateformat =…
-3
votes
2 answers

Problems importing com.db4o in Netbeans

It simply says: package com.db4o.* does not exist and it, ofc, exists, any idea? Windows 7 x64 / Netbeans 8.0.2
Mark
  • 684
  • 2
  • 9
  • 25
1 2 3
25
26