Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-20-2002, 11:56 PM   #1
LQ Newbie
Registered: Aug 2002
Location: Stockholm, Sweden
Distribution: Red Hat 7.x
Posts: 8

Rep: Reputation: 0
Reading Berkeley DB 1.85 in perl

I have a bunch of databases from an old forum system that I really want to extract the information from. Unfortunately the version of perl that I run now can't seem to load these files at all.

When running file on the db files I get this:
bash-2.05# file data/eon.db
data/eon.db: Berkeley DB 1.85 (Hash, version 2, native byte-order)
The old script used this to load the db:
dbmopen (%DB, "$db_dir/$db", 0644)
I'm using Perl 5.6.1 at the moment, installed from an rpm, the old perl version must have been 5.004 or maybe even earlier, from RH5.x I believe.

I've tried using tie together with different DB types, like DB_File, GDBM_File and SDBM_File but nothing seems to work.

Does anyone know what I'm doing wrong or have any insight at all that could help me?
Old 09-23-2002, 11:26 AM   #2
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
The message "data/eon.db: Berkeley DB 1.85 (Hash, version 2, native byte-order)" doesn't necessarily sound like an error code. I am assuming that file is a perl script? Can you post the code segment related to opening and reading the DB?
Old 01-25-2003, 08:14 PM   #3
LQ Newbie
Registered: Aug 2002
Location: Stockholm, Sweden
Distribution: Red Hat 7.x
Posts: 8

Original Poster
Rep: Reputation: 0
The command file is the standard program to determine a file type, I showed the output to show what type of DB it is.

The db files were created by a very old version of the forum system called WWWThreads and I want to extract the information to insert it into the MySQL database the new version uses. The old version is very old and hasn't been supported by the programmer for a long time.

Here is the part of the script that is trying to read this db file (this script used to work on an old perl version, but it broke when I upgraded a long time ago):
use vars qw(%DB %BI $board_index);
use strict;
use CGI;
use DB_File;

        my $db_dir     = '/path/to/data';
        my $db         = 'dbname';

        dbmopen (%DB, "$db_dir/$db", 0644) or die "Can't open board: $db. Reason
        foreach (reverse 0 .. $DB{'TOTAL'}) {   
                if ($DB{$_}) {
                        @data = split (/\t/, $DB{$_});
                        if ($data[0] eq "Main") {
        dbmclose (%DB) or die "Can't close board: $db. Reason: $!";
I've removed a lot of the code to save space, the problem is that dbmopen won't recognize the database at all.
Old 01-22-2015, 01:26 AM   #4
Registered: Jul 2007
Posts: 52

Rep: Reputation: 0
This 13-year-old discussion was never closed. No answer to the question
was ever posted. But I am having the same problem as the original
poster -- specifically, I am trying to read an aliases.db file that
was, apparently, created by an old sendmail program. The "file" command

Berkeley DB (Hash, version 5, native byte-order)

and this is, apparently, too old for DB_File to read.

Did you ever solve your original problem? If so, please
tell us how. If you do not think that this 13-year-old discussion
is of general interest, please do me the kindness of sending me
electronic mail -- jay at m5 dot chicago dot il dot us.

Thank you in advance for your reply.
Old 01-28-2015, 08:44 AM   #5
LQ Newbie
Registered: Aug 2002
Location: Stockholm, Sweden
Distribution: Red Hat 7.x
Posts: 8

Original Poster
Rep: Reputation: 0
I'm sorry, I never found a solution to this issue.
Old 01-28-2015, 02:37 PM   #6
Registered: Nov 2014
Posts: 167

Rep: Reputation: Disabled
Glibc provides older interfaces to bdb (see man dbopen). You could try opening the file using the C glibc interface.
Old 01-28-2015, 07:16 PM   #7
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,980

Rep: Reputation: 1442Reputation: 1442Reputation: 1442Reputation: 1442Reputation: 1442Reputation: 1442Reputation: 1442Reputation: 1442Reputation: 1442Reputation: 1442
I suggest that you inquire at


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql reading via Perl DBI ivanatora Programming 2 03-21-2007 05:03 AM
Perl - Reading Real Time streams vitoal18t Programming 10 05-18-2005 07:59 AM
Need Help in Reading a rather complex textile in perl!! domquem Programming 9 01-03-2005 02:39 PM
Perl and Berkeley db zolley Linux - Newbie 0 06-07-2004 06:43 AM
perl reading pdf,ps,txt j-ray Programming 1 02-04-2003 11:49 AM

All times are GMT -5. The time now is 01:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration