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
- 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
- To check if the LibDB are sucessufully installed, use the whereis:
whereis libdb
Installing LibDB from the source code
- 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
- Go to the PORT/linux directory
cd db.1.85.4/PORT/linux
- 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
- 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
- To use the libdb library in a program, you must pass in linkstep the -ldb parameter.
htcobol program.cob -ldb
- 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.
- 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...".
- 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:
- Although it was explained here how to install the major libraries of libdb 1.85.4, you should give preference to the libdb-1.85.4 version, because only this library version is free and another problem is that if you create a file using libdb 1.85.4 version and you try to modify this file using a major versions of libdb, this file won't be modified.
- Notice that you need to use the "--enable-compat185" parameter to enable the compatibility API from libdb 1.85.4 library.
How do I install LibDB in Windows environments?
Installing LibDB under the Cygwin
- 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
- 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
- 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
- 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)