NeoDatis V2 is a major update and will change many internal things, the main one being the ability to plug any storage engine. This mean that you will be able to use different storage engines depending on your needs. This gives interesting features like Terabytes NeoDatis database (using Berkeley Database Java Edition as a storage engine, for example), or having NeoDatis to work as a distributed database in the Cloud! (using http://project-voldemort.com database for example).
The current beta release currently works with JDBM, BerkeleyDB and project Voldemort
The distribution has a plugin directory. In this directory, there is a directory for each plugin. For example, there is a directory berkeleydb fro berkeleydb plugin and in this directory, there the plugin itself (neodatis-berkeleydb-plugin.jar) and the libs are in the plugin/berkeleydb/lib directory.
The same structure applies to all other plugins.
How can I download NeoDatis V2
- Download NeoDatis V2 at https://sourceforge.net/projects/neodatis-odb/files/, folder NeoDatis ODB for Java / 2
How to use NeoDatis V2 with default Storage engine (JDBM) ?
Necessary Jars :
- neodatis-odb.jar(NeoDatis) (in $NeoDatis/)
import java.util.Date; import org.neodatis.odb.NeoDatis; import org.neodatis.odb.NeoDatisConfig; import org.neodatis.odb.ODB; import org.neodatis.odb.Objects; import com.neodatis.odb.plugin.engine.berkeleydb.NeoDatisBerkeleyDBPlugin; /** * @author olivier * */ public class SimpleTest { public static void main(String[] args) { String baseName = "test.neodatis"; // Creates the database (data will be saved in the test.neodatis file ODB odb = NeoDatis.open(baseName); // Stores a new player odb.store(new Player("Luane", new Date(), new Sport("Squash"))); // Closes the database odb.close(); // re opens the database to get objects odb = NeoDatis.open(baseName); // Gets all the players Objects<Player> players = odb.query(Player.class).objects(); // display results while(players.hasNext()){ System.out.println(players.next()); } } }
How to use NeoDatis V2 with BerkeleyDB ?
Necessary Jars :
- neodatis-odb.jar(NeoDatis) (in $NeoDatis/)
- neodatis-berkeleydb-plugin.jar (BerkeleyDB plugin) (in $NeoDatis/plugins/berkeleydb)
- je-3.3.8x.jar(berkeleyDB) (in $NeoDatis/plugins/berkeleydb/lib)
import java.util.Date; import org.neodatis.odb.NeoDatis; import org.neodatis.odb.NeoDatisConfig; import org.neodatis.odb.ODB; import org.neodatis.odb.Objects; import com.neodatis.odb.plugin.engine.berkeleydb.NeoDatisBerkeleyDBPlugin; /** * @author olivier * */ public class SimpleTest { public static void main(String[] args) { String baseName = "test-with-berkeley-db.neodatis"; // Set Berkeley DB as the default storage engine NeoDatisConfig config = NeoDatis.getConfig().setStorageEngineClass(NeoDatisBerkeleyDBPlugin.class); // Creates the database (data will be saved in the test-with-berkeley-db.neodatis directory ODB odb = NeoDatis.open(baseName,config); // Stores a new player odb.store(new Player("Luane", new Date(), new Sport("Squash"))); // Closes the database odb.close(); // re opens the database to get objects odb = NeoDatis.open(baseName, config); // Gets all the players Objects<Player> players = odb.query(Player.class).objects(); // display results while(players.hasNext()){ System.out.println(players.next()); } } }
Same example with Voldemort plugin
Necessary Jars :
- neodatis-odb.jar(NeoDatis) (in $NeoDatis/)
- neodatis-voldemort-plugin (Voldemort plugin) (in $NeoDatis/plugins/voldemort)
- Voldemort jars(in $NeoDatis/plugins/voldemort/lib)
import java.util.Date; import org.neodatis.odb.NeoDatis; import org.neodatis.odb.NeoDatisConfig; import org.neodatis.odb.ODB; import org.neodatis.odb.Objects; import com.neodatis.odb.plugin.engine.voldemort.NeoDatisVoldemort; import com.neodatis.odb.plugin.engine.voldemort.NeoDatisVoldemortPlugin; import com.neodatis.odb.plugin.engine.voldemort.StoreServer; /** * @author olivier * */ public class SimpleTest { public static void main(String[] args) { String baseName = "test-voldemort.neodatis"; // Set Voldemort DB as the default storage engine NeoDatisConfig config = NeoDatis.getConfig().setStorageEngineClass(NeoDatisVoldemortPlugin.class); // Creates the server properties config.setHostAndPort("localhost",10001); // you can add servers by calling properties.addServer("another host", another port); // creates and starts the server StoreServer server = NeoDatisVoldemort.openServer(baseName,config); server.start(); // Connects to the database (data will be saved in the test-voldemort.neodatis directory ODB odb = NeoDatis.open(baseName,config); // Stores a new player odb.store(new Player("Luane", new Date(), new Sport("Squash"))); // Closes the database odb.close(); // re opens the database to get objects odb = NeoDatis.open(baseName,config); // Gets all the players Objects<Player> players = odb.query(Player.class).objects(); // display results while(players.hasNext()){ System.out.println(players.next()); } server.stop(); } }
For Voldemort, it is necessary to set the jvm memory to a higher value : example : -Xmx256M
Some imports may have changed from version 1.9. CTRL+O in eclipse should resolve them.
Please report any problem with the version at Source Forge bug report
There is also an open discussion about NeoDatis V2 here
Berkeley DB is an open source KeyValue store from Oracle : http://www.oracle.com/technology/products/berkeley-db/index.html
Voldemort is an open source KeyValue store database built and used by www.linkedin.com (http://project-voldemort.com/)







