Home

Packages: LIBDB CVS

Use: Debug



What is LibDB?

LibDB is a acronym of Berkeley Database Library. It's a couple of functions that allow the programmer store data in files. With libdb, the programmer can create all files used in COBOL programs(sequential, text, relative and indexed files).

The libDB library may be downloaded in SleepyCat or Ibiblio

What type of license LibDB is supported?

Until the 1.85.x and 1.86 versions, the LibDB is licensed under the GPL license.

The TinyCOBOL project suggest for users use this versions, because the use of later versions of LibDB is unnecessary and may change the license of TinyCOBOL, when it's compiled with later versions of LibDB.

How do I install LibDB in POSIX environments?

Installing LibDB from a RPM package

  1. Get the file db1-1.85.4-8.i386.rpm from TC download area. After, install it using the rpm:

    rpm -ivh db1-1.85.4-8.i386.rpm
    

  2. To check if the LibDB are sucessufully installed, use the whereis:

    whereis libdb
    

Installing LibDB from the source code

  1. Get the db-1.85.4-src.tar.gz file from TC download area. After, install it using tar.

    tar -zxvf db-1.85.4-src.tar.gz 
    

  2. Go to the PORT/linux directory

    cd db.1.85.4/PORT/linux 
    

  3. Use the Makefiles to start the compilation. You do "make all" to compilation the source and generate the necessary objects for linking. If you receive errors, execute the step 6 and do the step 3 again.

    make all 
    

  4. After compilation, it is time to link the objects, generate the libdb libraries and install them. To do that, you must use "make install":

    make install 
    

  5. To use the libdb library in a program, you must pass in linkstep the -ldb parameter.

    htcobol program.cob -ldb 
    

  6. This step should be executed ONLY if the LibDB compilation failed. In the 1.85.4 version of the LibDB library does exist some bugs in the files hash.h, hash.c and ndbm.c.

    1. Get the patch files of the hash.h, hash.c and ndbm.c files and go to the db.1.85.4/hash/ directory. To save it in your machine, click in the link with the right button of your mouse and click in "Save Link Target As...".
    2. Use the patch tool to apply the needed changes in each file as follows:

      $ user:~/db.1.85.4/PORT/linux$ cd ../../hash
      $ user:~/db.1.85.4/hash$ patch -p0 <hash.h.diff hash.h
      $ user:~/db.1.85.4/hash$ patch -p0 <hash.c.diff hash.c
      $ user:~/db.1.85.4/hash$ patch -p0 <ndbm.c.diff ndbm.c
      $ user:~/db.1.85.4/hash$ cd ../PORT/linux
      $ user:~/db.1.85.4/PORT/linux$ 
      

Installing major versions of LibDB:

P.S: In this case we are using the 2.7.7 version of LibDB.

Notes for instalation:

How do I install LibDB in Windows environments?

Installing LibDB under the Cygwin

  1. Get the db-1.85.4-src.tar.gz file from TC download area. After, open a Cygwin bash shell and unpack the LibDB library using tar.

    % cd /
    % tar -zxvf db-1.86-1.cygwin.tar.gz
    

  2. The structure tree should be according with the following criteria:
    • libdb.a in c:\Cygwin\lib (/usr/lib)
    • db.h in c:\Cygwin\usr\include\db.h (/usr/incude)
    • mpool.h in c:\Cygwin\usr\include\mpool.h (/usr/include)
    • btree.3 in c:\Cygwin\usr\man\man3\btree.3 (/usr/man/man3)
    • mpool.3 in c:\Cygwin\usr\man\man3\mpool.3 (/usr/man/man3)
    • hash.3 in c:\Cygwin\usr\man\man3\hash.3 (/usr/man/man3)
    • recno.3 in c:\Cygwin\usr\man\man3\recno.3 (/usr/man/man3)
    • dbopen.3 in c:\Cygwin\usr\man\man3\dbopen.3 (/usr/man/man3)

Installing Libdb under the MinGW

  1. Get the db-1.85-ac.mingw32.zip file from TC download area. After, open a DOS shell and unpack the LibDB library using pkunzip or any tool that uncompress ZIP files.

    c:\> pkunzip db-1.85-ac.mingw32.zip db.h c:\mingw\include
    c:\> pkunzip db-1.85-ac.mingw32.zip libdb.a c:\mingw\lib
    

  2. The structure tree should be according with the following criteria:
    • libdb.a in c:\mingw\lib\libdb.a (/mingw/lib)
    • db.h in c:\mingw\include\db.h (/mingw/include)