Download this file

index.md    65 lines (55 with data), 1.9 kB

MapDB provides concurrent TreeMap and HashMap backed by disk storage or off-heap memory. It is a fast, scalable and easy to use embedded Java database engine. It is tiny (160KB jar), yet packed with features such as transactions, space efficient serialization, instance cache and transparent compression/encryption. It also has outstanding performance rivaled only by native embedded db engines.

What people are saying

    News

    30/1/2013 MapDB overview video

    Follow news: RSS | Mail-List | Twitter

    Hello world

    import org.mapdb.*;
    
    //Configure and open database using builder pattern.
    DB db = DBMaker
        .newFileDB(new File("testdb"))
        .closeOnJvmShutdown()
        .make();
    
    //create new collection (or open existing)
    ConcurrentNavigableMap map = db.getTreeMap("collectionName");
    map.put(1,"one");
    map.put(2,"two");
    
    //persist changes into disk, there is also rollback() method
    db.commit();
    
    db.close();