Examining Berkeley Db Files from the Cli

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



Leave a reply



Submit