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

db4o on Android 4.4.+: storing an object fails because cannot cast long to integer

While running db4o library (Both 8.1-SNAPSHOT and 8.0), opening the database works oc = Db4oEmbedded.openFile(dbConfig(), db4oDBFullPath(context)); //context.getDir("data", 0) + "/" + "mDB.DB4O"; to get the full path However, once I start trying to…
Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66
2
votes
0 answers

Does db4o have any Management studio like app for adhoc querying?

Does db4o have any Management studio like app for adhoc querying? ObjectManager Enterprise I think is for development only since its embedded in either in visual studio or eclipse.. Is there any independent or separate app for browsing/manipulating…
Patrick87
  • 237
  • 1
  • 2
  • 10
2
votes
1 answer

db4o on shared hosting with asp.net MVC

I'm wanting to use DB4o on an asp.net MVC project i'm working on but wondering if anyone has got this working on shared hosting plan, have contacted discountasp and asked them and they said go to the forum as they were not sure if they supported it…
davethecoder
  • 3,856
  • 4
  • 35
  • 66
2
votes
1 answer

Db4o returing cached object

I am using embeddable version of db4o 8.1. The issue is when I retrieve an object and just call set of a property, it seems to be persisting the value in cache and subsequent retrieval gives me the same reference even when I try to retrieve by…
Liam
  • 2,837
  • 23
  • 36
2
votes
2 answers

Db4o StartsWith and ignore case

The following query takes a while to return: db.Query(x => x.StartsWith("Chr", StringComparison.CurrentCultureIgnoreCase)) is there a way to get this working correctly? ie faster?
Chris Kolenko
  • 1,020
  • 17
  • 32
2
votes
2 answers

Db4o select performance

I have 7000 objects in my Db4o database. When i retrieve all of the objects it's almost instant.. When i add a where constrain ie Name = "Chris" it takes 6-8 seconds. What's going on? Also i've seen a couple of comments about using Lucene for…
Chris Kolenko
  • 1,020
  • 17
  • 32
2
votes
2 answers

How should I use DB4O in ASP.NET

I'm interested in using DB4O in asp.net mvc applications. However I can't find any good samples that show how to set things up. For example, do I have to create a custom IHttpModule that manages the lifetime of a DB4O server instance? Any pointers…
Andrew Davey
  • 5,441
  • 3
  • 43
  • 57
2
votes
1 answer

When to choose DB4o over SQLite in Android Development

I am looking to switch from SQLite to DB4o for Android application , I have read couple of tutorial how to use DB4o in Android but not sure how efficient it is in case of Android, Please help me if you have used DB4o for android or know anything…
44kksharma
  • 2,740
  • 27
  • 32
2
votes
0 answers

How Efficient is DB4o for Android App Development

I am looking forward to switch from SQLite to DB4o for My Android Projects, I have a Question. Q1 .How dose DB4o avoids the data redundancy. for Example I have two class Class School { school info 1.... school info 2.... school info…
44kksharma
  • 2,740
  • 27
  • 32
2
votes
2 answers

db4o, Linq, and UUID's

Apparently the db4o website was recently redone, and now old urls are giving 404 errors. Everytime I think I've found the answer, I get a 404 error. I have a simple db4o database I've setup to store people. public class Person { public string…
Josh
  • 776
  • 6
  • 20
2
votes
1 answer

db4o mvc index page to detail page

in a MVC application it is quite common to have a list of objects that you click to see detail and / or edit. When using a relational db, this is achieved by using the primary key or id: <%= Html.ActionLink(dinner.Title, "Details", new {…
user10479
  • 790
  • 2
  • 9
  • 22
2
votes
4 answers

Am I wrong in wanting to roll my own Authenticate / Authorize system given the following requirements?

In my pet project I want to have a user system with the following requirements: It needs to work with Db4o as a persistance model I want to use DI (by means of Turbine) to deliver the needed dependencies to my user model It needs to be easy to plug…
Boris Callens
  • 90,659
  • 85
  • 207
  • 305
2
votes
1 answer

How to create database using Db4o in android?

I am developing an App in which now i have to create database for more better user experience. Then i came to know about DB4o which is many times faster tool for creating database than other like SQLite, MySql etc, but the problem is i am not able…
Rohit
  • 490
  • 3
  • 15
2
votes
1 answer

Improve db4o linq query

I got a problem with this linq query: from PersistedFileInfo fi in m_Database from PersistedCommit commit in m_Database where commit.FileIDs.Contains( fi.ID ) where fi.Path == select new Commit( m_Storage, commit ); As you can see,…
tanascius
  • 53,078
  • 22
  • 114
  • 136
2
votes
1 answer

how to store TimeStamp into db4o database

I am trying to store timestamps into a db4o database, but the stored timestamps which store a few mninutes ago are much different from the current date. Here are example outputs: 1969-12-31 19:00:00.741 1969-12-31 19:00:00.772 2012-10-14…
John
  • 31
  • 4