On this page

Database – Intro

Database

C++

Java

We create database simply as shown. This should be the first thing that we do before doing anything else.

db_param dpm;
dpm.setTransactionType(DB_TRANSACTION_NONE);
bangdb_database *bdb = bangdb_database::getInstance("mydb", *dpm);
if(!bdb)
{
    printf(""db could not be created, quitting\n");
    //handle the error
}
// DBParam sets the db environment, see the section to know more about it
Note: We must tell db where to find the bangdb.config file. This can be done by either keeping the file in the same dir as your application in case of embedded or in case of server the same dir as server. We can override this by setting the configPath in DBParam before calling getInstance
DBParam is used to set the db environment. It is described as below;

 

We create database simply as shown. This should be the first thing that we do before doing anything else.

DBParam dp;
dp.setTransactionType(DB_MULTIOPS_TRANSACTION_NONE);
BangDBDatabase bdb = new BangDBDatabase("mydb", dp);
if(bdb == null){
 System.out.println("db could not be created, quitting");
 // handle error, possibly return from here
}
// DBParam sets the db environment, see the section to know more about it
Note: We must tell db where to find the bangdb.config file. This can be done by either keeping the file in the same dir as your application in case of embedded or in case of server the same dir as server. We can override this by setting the configPath in DBParam before calling getInstance
DBParam is used to set the db environment. It is described as below;

 

 

Was this article helpful to you? Yes No