Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

using indexed (dbm) files

by pme (Prior)
on Jan 30, 2004 at 09:59 UTC ( #325190=perlquestion: print w/replies, xml ) Need Help??

pme has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I'd like to use the indexed (dbm) files from both Perl and C. The file is generated from Perl and read by program written in C. I'm totally confused by the file formats (ndbm, gdbm, Berkeley DB etc.). What format should I use? On Debian 3.0r2 there is man page for dbopen, but the db.h contains the db_create() only. I'd like to avoid installing new libraraies. Thanks in advance

Replies are listed 'Best First'.
Re: using indexed (dbm) files
by DrHyde (Prior) on Jan 30, 2004 at 12:23 UTC
    There's a nice feature comparison table here.
      Thanks, I've bookmarked it!
Re: using indexed (dbm) files
by RandomWalk (Beadle) on Jan 30, 2004 at 16:45 UTC
    From "Learning Perl": you might also check your AnyDBM_file manpage and/or you might want to download the "which_dbm" utility from

    The latter diagnoses which db you've already got.

      Thanks, I'll try it.
Re: using indexed (dbm) files
by scottj (Monk) on Jan 31, 2004 at 10:13 UTC
    I have done this in the past with Berkeley DB and had much success.

    I had a CGI written in C (way back in the day) that would write to the Berkeley DB. Then my perl script would come along every so often and yank the data out of the Berkeley DB for processing.

    I don't have a lot of experience with the other options you listed, but Berkeley DB is a very robust system that will probably handle just about anything you need it for. And the folks at Sleepycat are great, too. :)
Re: using indexed (dbm) files
by Anonymous Monk on Jan 30, 2004 at 23:40 UTC
    remember that C requires null terminated strings while perl does not.
Re: using indexed (dbm) files
by astroboy (Chaplain) on Feb 02, 2004 at 12:41 UTC
    Came across this site a couple of weeks ago. They do a pretty good job of looking at the various DBMS's and supply sample code, etc
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://325190]
Approved by b10m
Front-paged by DrHyde
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2020-09-28 19:23 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (144 votes). Check out past polls.