bg
Database – Embedded – BangDB = NoSQL + AI + Stream

Database – Embedded

chevron

Database

Embedded

C++

Selected

Java

Selected

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

	db_param dp;
	dp.setTransactionType(DB_TRANSACTION_NONE);
	bangdb_database *bdb = bangdb_database::getInstance("mydb", &dp);
	if(!bdb)
	{
		printf("db could not be created, quitting\n");
		// handle error, possibly return from here
	}
	// db_param 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 db_param before calling getInstance
db_Param is used to set the db environment. It is described as below;
// db related data, right now we send following to db db_transaction_type _tranType; // if db should be opened in transactional or non-transactional mode // pls note, db could be stopped and started in different way as needed // as far as transaction mode is concerned const char *_configPath; // path to bangdb.config file, optional - default is local current dir const char *_dbPath; // path where db files will be kept, optional - default is data dir in current dir const char *_dbLogPath; // path where log files will be kept, optional - default is logdir dir in current dir const char *_dbArchivePath; // path where archive files will be kept, optional - default is archive dir in current dir // following are only true for clients connecting over network const char *_host; // server ip const char *_port; // server port const char *_userid; // NULL for now const char *_password; // NULL for now

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;
// db related data, right now we send following to db TransactionType _tranType; // if db should be opened in transactional or non-transactional mode // pls note, db could be stopped and started in different way as needed // as far as transaction mode is concerned String _configPath; // path to bangdb.config file, optional - default is local current dir String _dbPath; // path where db files will be kept, optional - default is data dir in current dir String _dbLogPath; // path where log files will be kept, optional - default is logdir dir in current dir String _dbArchivePath; // path where archive files will be kept, optional - default is archive dir in current dir // following are only true for clients connecting over network String _host; // server ip String _port; // server port String _userid; // NULL for now String _password; // NULL for now