# 1. First Glance

Before diving straight into the first source code samples let's get you familiar with some basics.

## 1.1. The db4o engine...

The db4o object database engine consists of one single DLL. This is all that you need to program against. The version supplied with the distribution can be found in /usr/lib/db4o/.
/usr/lib/db4o/db4o.dll
The standard db4o engine for the Mono environment.

## 1.2. Installation

To use db4o in a development project, you only need to add the above db4o.dll file to your project references.
Here is how to do this if you are using MonoDevelop:
- Right-click on "References" in the Solution Tab
- choose "Edit References"
- select the ".NET Assembly" tab and then "Browse"
- select /usr/lib/db4o/db4o.dll
- click "Open"
- click "OK"

## 1.3. db4o Object Manager

db4o Object Manager is a GUI tool to browse and query the contents of any db4o database file. Object Manager has to be downloaded seperately from the main db4o distributions. Please visit the db4o Download Center and choose the installation appropriate for your system. The following distributions are currently available:
- db4o ObjectManager for Windows IKVM (Java VM included)
- db4o ObjectManager for Windows no Java VM
- db4o ObjectManager for Linux

## 1.4. API Overview

Do not forget the API documentation while reading through this tutorial. It provides an organized view of the API, looking from a namespace perspective and you may find related functionality to the theme you are currently reading up on.
For starters, the namespace com.db4o and com.db4o.query are all that you need to worry about.
com.db4o
The com.db4o namespace contains almost all of the functionality you will commonly need when using db4o. Two objects of note are com.db4o.Db4o, and the com.db4o.ObjectContainer interface.
The com.db4o.Db4o factory is your starting point. Static methods in this class allow you to open a database file, start a server, or connect to an existing server. It also lets you configure the db4o environment before opening a database.
The most important interface, and the one that you will be using 99% of the time is
com.db4o.ObjectContainer: This is your db4o database.
- An ObjectContainer can either be a database in single-user mode or a client connection to a db4o server.
- Every ObjectContainer owns one transaction. All work is transactional. When you open an ObjectContainer, you are in a transaction, when you commit() or rollback(), the next transaction is started immediately.
- Every ObjectContainer maintains it's own references to stored and instantiated objects. In doing so, it manages object identities, and is able to achieve a high level of performance.
- ObjectContainers are intended to be kept open as long as you work against them. When you close an ObjectContainer, all database references to objects in RAM will be discarded.
com.db4o.ext
In case you wonder why you only see very few methods in an ObjectContainer, here is why: The db4o interface is supplied in two steps in two namespaces , com.db4o and com.db4o.ext for the following reasons:
- It's easier to get started, because the important methods are emphasized.
- It will be easier for other products to copy the basic db4o interface.
- It is an example of how a lightweight version of db4o could look.
Every com.db4o.ObjectContainer object is also an com.db4o.ext.ExtObjectContainer. You can cast it to ExtObjectContainer or you can use the to get to the advanced features.
com.db4o.config
The com.db4o.config namespace contains types and classes necessary to configure db4o. The objects and interfaces within are discussed in the Configuration section.
com.db4o.query
The com.db4o.query namespace contains the Predicate class to construct Native Queries. The Native Query interface is the primary db4o querying interface and should be preferred over the Query API.
--
generated by Doctor courtesy of db4objects Inc.