readme

Please read this very short file thoroughly. Afterwards you can start working with db4o immediately by experimenting with the samples in com.db4o.samples.  


Contents

Installation
JavaDocs
Directories
Compatible classes
Opening a database file
Storing, Retrieving and Updating Objects
Navigation
JDK
JDBC
IDEs
Version
Updates
License
Price List
Change Log
Contact Us

Installation
Extract the downloaded file db4o.zip to a directory of your choice. This file readme.html will also be found there.

Add the file db4o.jar with it's complete path to your CLASSPATH setting. db4o.jar contains the complete database engine and it is the only library you need to program against. 

All other sourcecode files supplied with the download are public domain and can be used freely.


Directories
bat - batch file examples
com.db4o.bench - benchmark code to compare against relational databases
com.db4o.jgen - class generation code for SQL import runs
com.db4o.lib - library classes needed in the other packages
com.db4o.samples - samples how to use db4o
com.db4o.sql - code to export/import to/from SQL databases
com.db4o.test - db4o regression test code. Regression.java is the starting point for execution.
doc - documentation files including JavaDocs



Compatible classes
db4o attempts to store all objects of any class. Consult the code in com.db4o.test for possibilities.

db4o tries to use a public default constructor, if present. If not, db4o will use the first constructor available with getDeclaredConstructor that does not throw an exception upon creating a test instance. Be aware of this random usage and possible side effects.

db4o internally uses highly efficient wrappers for:
all simple types, all simple type wrappers, String, Date, arrays, Vector, Hashtable
Using typesafe declarations of the above, will result in better performance.

Limitations for all JDK 1.x versions:
- A class needs to have at least one  public constructor.
- Fields have to be declared public, to allow them to be found and modified by reflection. 

Declare members transient to avoid persistency.


Opening a database file
Open a database file by requesting an ObjectContainer from the Db4o factory class. Specify the full path to the database file as a parameter.

import com.db4o.*;
ObjectContainer container = Db4o.openFile("yourfile.yap");


The database file will be created, if it is not present.

container.close();
stops the engine and flushes all data to the file.


Storing, Retrieving and Updating Objects
To store a new object or to update an existing object:

container.set(Object object);


To obtain an ObjectSet of objects that match a given template object:

ObjectSet results = container.get(Object template);

All non-null members on the template will be evaluated against stored objects.
Arrays and Collections use "contains" comparison.


Iterate through the ObjectSet to access single objects.

while(results.hasNext()){
   Object resultObject = results.next()
}



Navigation
Upon a call to ObjectContainer#get() members are instantiated and activated to a depth of 5. The activation depth can be modified generally and class-specifically with the Configuration interface. Consult the JavaDocs for the available methods in the com.db4o.config package.

Members further down the hierarchy will be DEACTIVATED. In DEACTIVATED state, all Object members of an object are NULL, primitive types have the default value of 0.

DEACTIVATED objects can be activated with calls to
ObjectContainer#activate(Object object, int depth);

The mechanism is intended to allow control of instantiation and to traverse the entire graph of persistent objects.

Call ObjectContainer#deactivate(Object); to save memory.


JDK
db4o runs on all JDKs from JDK 1.1.x to present. Special versions to support JDK 2 features, Unicode and for the EPOC JVM are available from the website.


JDBC
db4o provides an interface to export and import data via JDBC.
See the jdbc documentation.


IDEs  
We recommend the usage of integrated development environments like JBuilder Foundation Edition or NetBeans. Remember to add db4o.jar to your project CLASSPATH. Some IDEs like IBM Visual Age disassemble Jar files internally and attempt to compile all sources. In this case you will also need to add Sun's Java Web Start Jar javaws.jar to work with db4o.


Version
Db4o.version() returns a string with the version of db4o, that you are using.


Updates
visit http://www.db4o.com
Join the db4o mailing list to be kept informed.


Price List
Please contact sales@db4o.com if you plan to include db4o in a commercial product.
A price list is available on the website.


Contact Us
Should you have any questions, ideas or bug reports, you are very welcome to send an email.

db4o
Happerger Strasse 18
82547 Eurasburg
Germany

---