Examining Berkeley DB files from the CLI
Check out the db-utils package. If you use apt, you can install it with the following: apt-get install db-util
(or apt-get install db4.8-util
or whatever version you have or prefer.)
Additional links:
- http://rpmfind.net/linux/rpm2html/search.php?query=db-utils
- https://packages.ubuntu.com/search?suite=default§ion=all&arch=any&keywords=db-util&searchon=names
- Man page of db4.4_dump
How to build berkeley db on linux
The makefile and configure scripts are located at DB_ROOT/dist/* , DB_ROOT is the root directory of the unzipped source codes.
The build guide is available at https://docs.oracle.com/database/bdb181/html/installation/build_unix.html#build_unix_intro
Mixed C++/CLI code with Berkeley DB
I can see two issues with your application:
1) The two calls to Marshal::FreeHGlobal are made before the contents of the buffers are used. You shouldn't free 'A' until after the put operation, and you shouldn't free 'a' until after both the put and get operations.
2) You are storing the pointers in Berkeley DB, rather than the strings themselves. That's due to the Dbt constructor calls. You're application is:
Dbt key1(&a,100);
It should be:
Dbt key1(a, 100);
Similarly for the getKey.set_data method - it should use the pointer, not a reference to the pointer.
Once I made the above changes to your application, it ran as expected.
Regards,
Alex Gorrod
Oracle Berkeley DB
Related Topics
How to Force 'Cp' to Overwrite Directory Instead of Creating Another One Inside
Error: Can't Open Display: (Null) When Using Xclip to Copy Ssh Public Key
Installed Go Binary Not Found in Path on Alpine Linux Docker
Turning Multiple Lines into One Comma Separated Line
View a Log File in Linux Dynamically
Linux/Bash, Using Ps -O to Get Process by Specific Name
Mongodb Data Directory /Data/Db Not Found
How to Mount One Partition from an Image File That Contains Multiple Partitions on Linux
Merge Multiple Jpgs into Single PDF in Linux
How to Do Division with Variables in a Linux Shell
Architecture of I386 Input File Is Incompatible with I386:X86-64