BangDB Download

Downloads: 3605

Native Linux Native Windows C# Windows Java Linux Java Windows

BangDB 1.0 - Embededded for Native Linux

     Please login | register to download bangdb!

[size: 221.32 KB] md5: 5f5d42c3a6838db9421af153b4eca7a6
[size: 199.29 KB] md5: a624a886ca8153f85a7a4dd9ad69f6c5
[size: 9.35 KB] md5: fdcd364da124cab7e4b24e7b618db2e2

Getting started with the BangDB for linux native

  • Install:
  • Please download the BangDB for linux native file and un-compress it. Run the install.sh file to install the BangDB.

    The download files are (once un-compressed):

    • include folder - This contains all the headers and soruce files needed to build app
    • libbangdb.so.1 - The BangDB library
    • install-bangdb.sh - The BangDB install file
    • uninstall-bangdb.sh - The BangDB uninstall file
    • bangdb.config - The config file for BangDB
    • README.txt - General info for the db and the release
  • To build an application for BangDB, you can either download the test files (from listed above) and simply build and run it for test and then extend as required or can create from scratch as it's very simple and straight forward to create application for BangDB. Below are the steps to create an application on linux.

    To run the test files, simply download the tar file, untar it and then cd to the directory and run following command;

    g++ -D_FILE_OFFSET_BITS=64 -O3 bench.cpp -obench -lpthread -lbangdb

    Then run the exe with command line arg as suggested by the exe. For example to put and get 100,000 items with 4 threads run

    ./bench 4 100000 all

  • Below is sample code to do some simple operations using BangDB. The bangdb.config file defines many configurable parameters, but most importantly edit the following values based on your liking;
    • SERVER_DIR - This is basically the location where the db will keep its files
    • IDX_SIZE - This is to denote the maximum length of key that you will be using to store values. The min value is 8 bytes, and maximum is dependent upon the PAGE_SIZE defined. however keep it small for better performance
    • BUFF_POOL_SIZE_HINT - The size of the buffer pool
    • Please look at the document which describes meaning of various parameters in the config file at resources
  • 	/* Create db, table and connection */
    	database *db = new database((char*)"mydb");
    	table *tbl = db->gettable((char*)"mytbl", 0);
    	if(tbl == NULL)
    	{
    		printf("Table is NULL, quitting");
    		return -1;
    	}				
    	connection *conn = tbl->getconnection();
    	if(conn == NULL)
    	{
    		printf("Connection is NULL, quitting");
    		return -1;
    	}		
    			
    	/* do some operations */
    	char *key = "key_1";
    	char *val = "This is the test value for key_1";
    				
    	/* put */
    	if(conn->put(key, val, INSERT_UNIQUE) < 0)
    		printf("Put error");
    					
    	/* get */
    	char *out = conn->get(key);
    	if(out == NULL)
    		printf("Get error");
    				
    	/* update */
    	val = "Update value for the test key";
    	if(conn->put(key, val, UPDATE_EXISTING) < 0)
    		printf("Update error");
    					
    	/* del */
    	if(conn->del(key) < 0)
    		printf("Del error");
    					
    	/* try to get the del key */
    	if(conn->get(key) != NULL)
    		printf("Got the deleted value, error");
    	

    I have just used char string for keys and values, however, you can use any arbitrary bytes for these using FDT data type. Also look at the general getting started for example using FDT Check out more in the available test/bench files which can be downloaded for further experiments.

BangDB 1.0 - Embededded for Native Windows

     Please login | register to download bangdb!

[size: 86.56 KB] md5: 37619fe0ef9a10dfcbac796a084e39fa
[size: 98.77 KB] md5: 68f075f81813e8a81c009092bac322ec
[size: 4.69 KB] md5: c6de32c69f3dfb93ee0274152f93d6b2

Getting started with the BangDB for windows native

  • Install:
  • Please download the BangDB for windows native file and un-compress it using 7zip. If you don't have 7zip the you can get it from 7zip-org. Store the un-compressed files and folder wherever you like. You can also create path variable to locate these files but it's not required.

    The download files are (once un-compressed):

    • include folder - This contains all the headers and soruce files needed to build app
    • bangdbwin.dll - The BangDB dll
    • bangdbwin.lib - The BangDB lib file
    • bangdbwin.exp - The BangDB exported functions file
    • bangdb.config - The config file for BangDB
    • README.txt - General info for the db and the release
  • To build an application for BangDB, you can either download the test files (from listed above) and simply build and run it for test and then extend as required or can create from scratch as it's very simple and straight forward to create application for BangDB. Below are the steps to create an application using Visual Studio
  • To run the test file available above for dowload, create an empty console project. Change the config to target x64 or x86 based on whether you would like the app for 64 bit or 32 bit respectively.
  • Add the downloaded files(headers and source files under project root folder) into the project, that is in the newly created project folder, copy the whole include dir. Also copy the dll, lib config in the dir. Now download and unzip the test file. Copy and paste the all the test files as well into the project dir.

    To avoid several errors due to pre-compiled header errors etc, switch off pre-compiled header option (Project-->Properties-->Configuration-->Precompiled Headers).

    Now add all these files in the solution (by right clicking the solution then add --> existing items). Delete the default main file created by the VS

    Then add the folder where you have kept the dll/lib, not required if these are present in the project dir (Project-->Properties-->Configuration-->C/C++-->General-->Additional Include Dir). Finally link the lib (bangdbwin.lib) in the project (Project-->Configuration-->C/C++-->Linker-->Input-->Additional Dependencies), type in bangdbwin.lib in the place. Now we have satisfied the VS and its compiler.

    Project should build now. If you get pre compiled header error then disable them from project-->properties-->C/C++-->Precompiled Headers etc... You should now be able to run the test. To insert 100,000 items using 4 threads, issue the command (or set the command line arg in VS) like following;

    exename 4 100000 put

    exename 4 100000 get

    >etc...

  • Below is sample code to do some simple operations using BangDB. The bangdb.config file defines many configurable parameters, but most importantly edit the following values based on your liking;
    • SERVER_DIR - This is basically the location where the db will keep its files
    • IDX_SIZE - This is to denote the maximum length of key that you will be using to store values. The min value is 8 bytes, and maximum is dependent upon the PAGE_SIZE defined. however keep it small for better performance
    • BUFF_POOL_SIZE_HINT - The size of the buffer pool
    • Please look at the document which describes meaning of various parameters in the config file at resources
  • 	/* Create db, table and connection */
    	database *db = new database((char*)"mydb");
    	table *tbl = db->gettable((char*)"mytbl", 0);
    	if(tbl == NULL)
    	{
    		printf("Table is NULL, quitting");
    		return -1;
    	}				
    	connection *conn = tbl->getconnection();
    	if(conn == NULL)
    	{
    		printf("Connection is NULL, quitting");
    		return -1;
    	}		
    			
    	/* do some operations */
    	char *key = "key_1";
    	char *val = "This is the test value for key_1";
    				
    	/* put */
    	if(conn->put(key, val, INSERT_UNIQUE) < 0)
    		printf("Put error");
    					
    	/* get */
    	char *out = conn->get(key);
    	if(out == NULL)
    		printf("Get error");
    				
    	/* update */
    	val = "Update value for the test key";
    	if(conn->put(key, val, UPDATE_EXISTING) < 0)
    		printf("Update error");
    					
    	/* del */
    	if(conn->del(key) < 0)
    		printf("Del error");
    					
    	/* try to get the del key */
    	if(conn->get(key) != NULL)
    		printf("Got the deleted value, error");
    	

    I have just used char string for keys and values, however, you can use any arbitrary bytes for these using FDT data type. Also look at the general getting started for example using FDT Check out more in the available test/bench files which can be downloaded for further experiments.

BangDB 1.0 - Embededded for Windows, C#

     Please login | register to download bangdb!

[size: 87.3 KB] md5: 2e1b25037963fecb12494c711d2490f5
[size: 99.31 KB] md5: effe1f3f255f9917b63d80b42fb17024
[size: 2.21 KB] md5: 973f2984c0c6219fd393ef4d7b059e20

Getting started with the BangDB for csharp on windows

  • Install:
  • Please download the BangDB for C# for Windows file and un-compress it using 7zip. If you don't have 7zip the you can get it from 7zip-org. Store the un-compressed files and folder wherever you like. You can also create path variable to locate these files but it's not required.

    The download files are (once un-compressed):

    • BangDB-CSharp.dll - The C# wrapper for bangdb
    • bangdbwin.dll - The BangDB dll
    • bangdbwin.lib - The BangDB lib file
    • bangdbwin.exp - The BangDB exported functions file
    • bangdb.config - The config file for BangDB
    • README.txt - General info for the db and the release
  • To build an application for BangDB, you can either download the test files (from listed above) and simply build and run it for test and then extend as required or can create from scratch as it's very simple and straight forward to create application for BangDB. Below are the steps to create an application using Visual Studio
  • Create an empty csharp console project. Change the config to target x64 or x86 based on whether you would like the app for 64 bit or 32 bit respectively.
  • Add reference to the BangDB-CSharp.dll from the project. To do this go to Add Reference-->Browse-->locate the dll on your machine. If you want to run the test files available above for download, simply add these files in the project.
  • Finally we just need to tell app where to find the downloaded dlls. If we set the path variable then this is not required else we have to put a global var like string path = "C:\\BangDB_DLLs" etc.... If you are using the test file from above download, then this var is in Program.cs inside Main.
  • Below is sample code to do some simple operations using BangDB. The bangdb.config file defines many configurable parameters, but most importantly edit the following values based on your liking;
    • SERVER_DIR - This is basically the location where the db will keep its files
    • IDX_SIZE - This is to denote the maximum length of key that you will be using to store values. The min value is 8 bytes, and maximum is dependent upon the PAGE_SIZE defined. however keep it small for better performance
    • BUFF_POOL_SIZE_HINT - The size of the buffer pool
    • Please look at the document which describes meaning of various parameters in the config file at resources
  • 	/* Set the path, change it accordingly */
    	string path = "C:\\BangDB_DLLs";	
    	
    	/* get a db, table and connection */
    	Database db = new Database("mydb", path);
    	Table tbl = db.GetTable("mytbl");
    	Connection conn = tbl.GetConnection();
    	
    	byte[] k = Encoding.UTF8.GetBytes("key_1");
    	byte[] v = Encoding.UTF8.GetBytes("The test value is 1");
    	
    	/* put and get value */
    	if(conn.Put(k, v, (int)InsertOptions.InsertUnique) < 0)
    	{
    		Console.Writeline("error in put");
    	}
    	
    	byte[] rval = conn.Get(k);
    	if(rval == null)
    	{
    		Console.Writeline("error in get");
    	}
    	if(!rval.SequenceEqual(v))
    	{
    		Console.Writeline("error, value doesn't match");
    	}
    	
    	/* update the value */
    	v = Encoding.UTF8.GetBytes("The test value is 2");
    	
    	if(conn.Put(k, v, (int)InsertOptions.UpdateExisting) < 0)
    	{
    		Console.Writeline("error in update");
    	}
    	
    	/* delete the key */
    	if(conn.Del(k) < 0)
    	{
    		Console.Writeline("error in del");
    	}
    	
    	db.CloseDatabase();
    	

    Also look at the general getting started and the test files available above

BangDB 1.0 - Embededded for Java Linux

     Please login | register to download bangdb!

[size: 16.74 KB] md5: 784e289b2167ca79cdb53582584f8bfd
[size: 16.3 KB] md5: fc857af2b982264b99c6a2d33605540d
[size: 5.35 KB] md5: 40d072b4b1929e1fcf1de53802cf624c

Getting started with the BangDB for Java on Linux

  • Install:
  • Download the binaries for BangDB java for Linux from above for the target architecture (32 or 64bit) based on your requirement. The java support for bangdb has been provided through JNI interface hence you would need the native binaries as well. Therefore you are requested to download the BangDB native for linux for the same architecture as well. If you download the binaries for java and native then you will get following;

    • bangdb-linux-XX-java-1.0.tar.gz - downloaded from above
      • bangdb.jar - Contains classes for BangDB wrapper in Java
      • libbangdb.so - The library for the jni files
      • bangdb.config - The configuration file for BangDB
    • bangdb-linux-XX-native-1.0.tar.gz - downloaded from "Native Linux" tab
      • include folder - This contains all the headers and soruce files needed to build app
      • libbangdb.so.1 - The BangDB library
      • install-bangdb.sh - The BangDB install file
      • uninstall-bangdb.sh - The BangDB uninstall file
      • bangdb.config - The config file for BangDB
      • README.txt - General info for the db and the release
    • To install the BangDB native, run the install-bangdb.sh file. Please look at the "Native Linux" tab for more info

  • To build an application in java for BangDB, you can simply download the test/bench application available above and then edit/extend to suit your need, or can start from scratch as it's very simple to create application using BangDB

    To run the test file, simply download the tar file from above, untar it, cd to the directory. Copy the bangdb.jar and libbangdb.so to the current dir from bangdb-linux-XX-java-1.0.tar.gz file. Run the make-app.sh file to compile the files and then simply run the exeapp.sh

    You can run the test app now as follows to get and put 100,000 items using 4 threads;

    bash exeapp.sh 10000 4

    Note that you will need bangdb-linux-XX-native-1.0 installed and also the bangdb-linux-XX-java-1.0 to build app in java for BangDB

  • Below is sample code to do some simple operations using BangDB. The bangdb.config file defines many configurable parameters, but most importantly edit the following values based on your liking;
    • SERVER_DIR - This is basically the location where the db will keep its files
    • IDX_SIZE - This is to denote the maximum length of key that you will be using to store values. The min value is 8 bytes, and maximum is dependent upon the PAGE_SIZE defined. however keep it small for better performance
    • BUFF_POOL_SIZE_HINT - The size of the buffer pool
    • Please look at the document which describes meaning of various parameters in the config file at resources
  • To compile and run, you will need to include the bangdb.jar and libbangdb.so. For example, if you code is under the package testbangdb, and you have kept bangdb.jar and libbangdb.so in the root folder then you can run following to compile stuff from the root dir
  • javac -cp "bangdb.jar" testbangdb/*.java

    and to run the app, use following

    java -cp .:bangdb.jar -Djava.library.path="." testbangdb.mainclass cmdargs[change the mainclass with name of your class which contains main(), and provide command line arguments as required]

    	/* create db, table and get connection */
    	System.loadLibrary("bangdbjava");
    	Database db = new DatabaseImpl("mydb");
    	Table tbl = db.getTable("mytbl", DBACCESS.OPENCREATE);
    	if(tbl == null)
    	{
    		System.out.println("table null error");
    		return;
    	}
    	Connection conn = tbl.getConnection();
    	if(conn == null)
    	{
    		System.out.println("connection null error");
    		return;
    	}
    	
    	bool success = true;
    	
    	/* insert a value and get it */
    	String k = "my key\0sjsj";
    	String v = "The test value";
    	byte[] key = k.getBytes();
    	byte[] val = v.getBytes();
    
    	if(conn.put(key, val, INSERTOPTIONS.INSERT_UNIQUE) < 0)
    	{
    		success = false;
    		System.out.println("Put failed");
    	}
    		
    	byte[] retval = conn.get(key);
    	if(retval == null)
    		System.out.println("Get Failed.");
    	else
    	{
    		if(!Arrays.equals(retval, val))
    	    	System.out.println("Get Mismatch.");
    	}
    	
    	/* update */ 
    	v = "This is the updated value";
    	val = v.getBytes();
    
    	if(conn.put(key, val, INSERTOPTIONS.UPDATE_EXISTING) < 0)
    	{
    		success = false;
    		System.out.println("Update failed");
    	}
    		
    	retval = conn.get(key);
    	if(retval == null)
    		System.out.println("Get Failed.");
    	else
    	{
    		if(!Arrays.equals(retval, val))
    	    	System.out.println("Get Mismatch.");
    	}
    	
    	/* delete */
    	if(conn.del(key) < 0)
    	{
    		success = false;
        	System.out.println("delete failed");
    	}
    		
    	if(conn.get(key) != null)
    	{
    		success = false;
    		System.out.println("got deleted value, failed");
    	}
    	
    	/* for string types */
    	k = "str key_1";
    	v = "This is value 1 for key 1";
    		
    	if(conn.put(k, v, INSERTOPTIONS.INSERT_UPDATE) < 0)
    	{
    		success = false;
    		System.out.println("str put, failed");
    	}
    		
    	String outval;
    	if((outval = conn.get(k)) == null)
    	{
    		success = false;
    		System.out.println("str get, failed");
    	}
    	else if(outval.compareTo(v) != 0)
    	{
    		success = false;
    	   	System.out.println("str mismatch get, failed");
    	}
    	
    	db.closeDatabase(DBCLOSE.DEFAULT);
    	if(success)
    		System.out.println("Test Passed");
    	else
    		System.out.println("Test Failed");	
    		
    	return;
    	

BangDB 1.0 - Embededded for Java Windows

     Please login | register to download bangdb!

[size: 89.9 KB] md5: c76859a654a208ed4ae2c57d6c309c15
[size: 102.21 KB] md5: 7ff718ba1475377a66d414d463dce31c
[size: 17.81 KB] md5: 64aa394937f3a4995058b62eeec807a4

Getting started with the BangDB for Java on Windows

  • Install:
  • Download the binaries for BangDB java for Windows from above for the target architecture (32 or 64bit) based on your requirement. The java support for bangdb has been provided through JNI interface hence you would need the native binaries as well which is included in the download. If you download the binaries for java then you will get following;

    • bangdb-linux-XX-java-1.0.7z - downloaded from above
      • bangdb.jar - Contains classes for BangDB wrapper in Java
      • bangdbjava.dll - The library for the jni files
      • bangdbwin.dll - The bangdb native dll for windows
      • bangdb.config - The configuration file for BangDB
  • To build an application in java for BangDB, you can simply download the test/bench application available above and then edit/extend to suit your need, or can start from scratch as it's very simple to create application using BangDB

    To run the test file, simply download the test zip file from above, unzip it, cd to the directory. Run the make-app.bat file to compile the files and then simply run the exeapp.bat

    You can run the test app now as follows to get and put 100,000 items using 4 threads;

    exeapp.bat 10000 4

  • Below is sample code to do some simple operations using BangDB. The bangdb.config file defines many configurable parameters, but most importantly edit the following values based on your liking;
    • SERVER_DIR - This is basically the location where the db will keep its files
    • IDX_SIZE - This is to denote the maximum length of key that you will be using to store values. The min value is 8 bytes, and maximum is dependent upon the PAGE_SIZE defined. however keep it small for better performance
    • BUFF_POOL_SIZE_HINT - The size of the buffer pool
    • Please look at the document which describes meaning of various parameters in the config file at resources
  • To compile and run, you will need to include the bangdb.jar and bangdbjava.dll. For example, if you code is under the package testbangdb, and you have kept bangdb.jar and bangdbjava.dll in the root folder then you can run following to compile stuff from the root dir
  • javac -cp "bangdb.jar" testbangdb/*.java

    and to run the app, use following

    java -cp .;bangdb.jar -Djava.library.path="." testbangdb.mainclass cmdargs[change the mainclass with name of your class which contains main(), and provide command line arguments as required]

    	/* create db, table and get connection */
    	System.loadLibrary("bangdbjava");
    	Database db = new DatabaseImpl("mydb");
    	Table tbl = db.getTable("mytbl", DBACCESS.OPENCREATE);
    	if(tbl == null)
    	{
    		System.out.println("table null error");
    		return;
    	}
    	Connection conn = tbl.getConnection();
    	if(conn == null)
    	{
    		System.out.println("connection null error");
    		return;
    	}
    	
    	bool success = true;
    	
    	/* insert a value and get it */
    	String k = "my key\0sjsj";
    	String v = "The test value";
    	byte[] key = k.getBytes();
    	byte[] val = v.getBytes();
    
    	if(conn.put(key, val, INSERTOPTIONS.INSERT_UNIQUE) < 0)
    	{
    		success = false;
    		System.out.println("Put failed");
    	}
    		
    	byte[] retval = conn.get(key);
    	if(retval == null)
    		System.out.println("Get Failed.");
    	else
    	{
    		if(!Arrays.equals(retval, val))
    	    	System.out.println("Get Mismatch.");
    	}
    	
    	/* update */ 
    	v = "This is the updated value";
    	val = v.getBytes();
    
    	if(conn.put(key, val, INSERTOPTIONS.UPDATE_EXISTING) < 0)
    	{
    		success = false;
    		System.out.println("Update failed");
    	}
    		
    	retval = conn.get(key);
    	if(retval == null)
    		System.out.println("Get Failed.");
    	else
    	{
    		if(!Arrays.equals(retval, val))
    	    	System.out.println("Get Mismatch.");
    	}
    	
    	/* delete */
    	if(conn.del(key) < 0)
    	{
    		success = false;
        	System.out.println("delete failed");
    	}
    		
    	if(conn.get(key) != null)
    	{
    		success = false;
    		System.out.println("got deleted value, failed");
    	}
    	
    	/* for string types */
    	k = "str key_1";
    	v = "This is value 1 for key 1";
    		
    	if(conn.put(k, v, INSERTOPTIONS.INSERT_UPDATE) < 0)
    	{
    		success = false;
    		System.out.println("str put, failed");
    	}
    		
    	String outval;
    	if((outval = conn.get(k)) == null)
    	{
    		success = false;
    		System.out.println("str get, failed");
    	}
    	else if(outval.compareTo(v) != 0)
    	{
    		success = false;
    	   	System.out.println("str mismatch get, failed");
    	}
    	
    	db.closeDatabase(DBCLOSE.DEFAULT);
    	if(success)
    		System.out.println("Test Passed");
    	else
    		System.out.println("Test Failed");	
    		
    	return;