Skip to content
feiben edited this page Jan 15, 2016 · 6 revisions

Following the examples to get started. Runnable java examples are under the folder "https://github.com/LunarBaseEngin/Application/tree/master/src/LCG/Examples", clone this project to your desktop, and run it for yourself:

creation.conf is the configuration file that tells LunarBase how to initialize a database. Any parameters in the creation example can be changed to meet your requirements. For example, if you need to cache the hottest 1 million records in memory, you shall change the parameter cache_records_in_memory = 20, (1 << 20 = 1 million). Of course, all the runtime tunable parameters can be changed at any time the db running.

**## Case 0 CreateDB: **

 String creation_conf = "/home/feiben/EclipseWorkspace/LunarBaseApplication/creation.conf";  
 LunarDB.getInstance().createDB(creation_conf);  
 LunarDB.getInstance().closeDB();  

Change the path of file to where your creation.conf located. Within the creation.conf, it tells us the database is located under root_path=/home/feiben/DBTest/, and the name is RTSeventhDB.

# ----------------#  
# Global settings #  
# --------------- #  

root_path=/home/feiben/DBTest/  

database_name = RTSeventhDB  

So the db root is /home/feiben/DBTest/RTSeventhDB, from where the DBTaskCenter knows to create the engine instance:

**## Case 1 Insert records and query: **

String db_root = "/home/feiben/DBTest/RTSeventhDB";  
DBTaskCenter tc = new DBTaskCenter(db_root);  

After we get an instance of DBTaskCenter, we will insert real data into this database and let it do its jobs for you.

Clone this wiki locally