BerkeleyDB Problems
Hello, I am moving a website that now resides on a i686 server running RedHat 6.2 with perl v5.005_03 to another i686 server running Suse 7.1 with perl v5.6.1. The website uses a number of cgi scripts that read and write from BerkeleyDB files using the tie function. The site is currently running fine on the RedHat server, but when testing the scripts on the Suse box I am finding the the scripts are failing complaining that the db file cannot be opened. The function calling the script is as follows... $db = "blurb"; tie(%BLURB, "DB_File", $db, O_RDONLY, 0664) || die("Error: could not open $db: $!\n"); Things I have tried so far.. - I have checked that the BerkeleyDB file (blurb) in the right path, and is readable/writable. - I have checked that the DB file is not corrupt by ftping it back to the RedHat box and testing it.. Works fine.. - the command "file blurb" shows that the db file is Berkeley DB (Hash, version 5, native byte-order) and my guess is the version of DB_File cannot read that DB version. I have installed earlier versions of DB_File on the Suse box with no luck. - I have successfully created a new db file using tie. The file created is version 7. Since these scripts do infact work on the RedHat server, what do I need to do to get them to work on the Suse server Any help would be greatly appreciated.. Mark Matthews
Re: BerkeleyDB Problems
On Tue, Mar 12, 2002 at 11:06:00AM -0500, Mark Matthews wrote: > Hello, > > I am moving a website that now resides on a i686 server running RedHat > 6.2 with perl v5.005_03 to another i686 server running Suse 7.1 with > perl v5.6.1. > The website uses a number of cgi scripts that read and write from > BerkeleyDB files using the tie function. > > The site is currently running fine on the RedHat server, but when > testing the scripts on the Suse box I am finding the the scripts are > failing complaining that the db file cannot be opened. > The function calling the script is as follows... > $db = "blurb"; > tie(%BLURB, "DB_File", $db, O_RDONLY, 0664) || die("Error: could not > open $db: $!\n"); > > Things I have tried so far.. > - I have checked that the BerkeleyDB file (blurb) in the right path, and > is readable/writable. > - I have checked that the DB file is not corrupt by ftping it back to > the RedHat box and testing it.. Works fine.. > - the command "file blurb" shows that the db file is Berkeley DB (Hash, > version 5, native byte-order) and my guess is the version of DB_File > cannot read that DB version. I have installed earlier versions of > DB_File on the Suse box with no luck. > - I have successfully created a new db file using tie. The file created > is version 7. > > Since these scripts do infact work on the RedHat server, what do I need > to do to get them to work on the Suse server DB_File is usually implemented on top of whatever the latest Berkeley DB is available. The file formats are usually not compatible from major version to another major version. I believe RH 6.2 uses bdb v2 and Suse uses a newer version 3 or 3.1. Use the rpm -q -a command to find out which versions are which. Anyway, you need to try out the db_upgrade command, it should upgrade the db file to the latest format. It might not be installed by default, so check your local docs. (I think it's in db3-utils, or some such..) You might also try out the BerkeleyDB module for access to more interesting features provided by the later versions of this library. In particular the transactions subsystem is very, very cool. Good Luck -- Paul Lindner[EMAIL PROTECTED] | | | | | | | | | | mod_perl Developer's Cookbook http://www.modperlcookbook.org/ Human Rights Declaration http://www.unhchr.ch/udhr/
Re: BerkeleyDB Problems
Mark Matthews wrote: > Hello, > > I am moving a website that now resides on a i686 server running RedHat > 6.2 with perl v5.005_03 to another i686 server running Suse 7.1 with > perl v5.6.1. > > The website uses a number of cgi scripts that read and write from > BerkeleyDB files using the tie function. > > The site is currently running fine on the RedHat server, but when > testing the scripts on the Suse box I am finding the the scripts are > failing complaining that the db file cannot be opened. > > The function calling the script is as follows... > $db = "blurb"; > tie(%BLURB, "DB_File", $db, O_RDONLY, 0664) || die("Error: could not > open $db: $!\n"); > > Things I have tried so far.. > - I have checked that the BerkeleyDB file (blurb) in the right path, and > is readable/writable. > - I have checked that the DB file is not corrupt by ftping it back to > the RedHat box and testing it.. Works fine.. > - the command "file blurb" shows that the db file is Berkeley DB (Hash, > version 5, native byte-order) and my guess is the version of DB_File > cannot read that DB version. I have installed earlier versions of > DB_File on the Suse box with no luck. > - I have successfully created a new db file using tie. The file created > is version 7. > > Since these scripts do infact work on the RedHat server, what do I need > to do to get them to work on the Suse server Mark, I doubt this has anything to do with mod_perl. Have you tested the functionality as a standalone script or even a one liner? In any case make sure that you have the same versions of BerkeleyDB and DB_File installed on both machines. Notice that there are three different major versions of BerkeleyDB. The latest BerkeleyDB versions 2 and 3 require a different Perl module: BerkeleyDB.pm and it won't work with older 1st version of BerkeleyDB lib. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: BerkeleyDB Problems
> On Tue, Mar 12, 2002 at 11:06:00AM -0500, Mark Matthews wrote: > > Hello, > > > > I am moving a website that now resides on a i686 server running RedHat > > 6.2 with perl v5.005_03 to another i686 server running Suse 7.1 with > > perl v5.6.1. > > > The website uses a number of cgi scripts that read and write from > > BerkeleyDB files using the tie function. > > > > The site is currently running fine on the RedHat server, but when > > testing the scripts on the Suse box I am finding the the scripts are > > failing complaining that the db file cannot be opened. > > > The function calling the script is as follows... > > $db = "blurb"; > > tie(%BLURB, "DB_File", $db, O_RDONLY, 0664) || die("Error: could not > > open $db: $!\n"); > > > > Things I have tried so far.. > > - I have checked that the BerkeleyDB file (blurb) in the right path, and > > is readable/writable. > > - I have checked that the DB file is not corrupt by ftping it back to > > the RedHat box and testing it.. Works fine.. > > - the command "file blurb" shows that the db file is Berkeley DB (Hash, > > version 5, native byte-order) and my guess is the version of DB_File > > cannot read that DB version. I have installed earlier versions of > > DB_File on the Suse box with no luck. > > - I have successfully created a new db file using tie. The file created > > is version 7. > > > > Since these scripts do infact work on the RedHat server, what do I need > > to do to get them to work on the Suse server > > DB_File is usually implemented on top of whatever the latest > Berkeley DB is available. The file formats are usually not > compatible from major version to another major version. I believe > RH 6.2 uses bdb v2 and Suse uses a newer version 3 or 3.1. Use the > rpm -q -a command to find out which versions are which. > > Anyway, you need to try out the db_upgrade command, it should > upgrade the db file to the latest format. It might not be installed > by default, so check your local docs. (I think it's in db3-utils, > or some such..) > > You might also try out the BerkeleyDB module for access to more > interesting features provided by the later versions of this library. > In particular the transactions subsystem is very, very cool. > > Good Luck > > -- It's more complicated than that :-( Newer versions of Linux (e.g. RedHat 6, SuSe 6) ship with a C library that has version 2.x of Berkeley DB linked into it. My particular version has 2.x with header files for 3.x. To make matters worse, prior to Perl 5.6.1, the perl binary itself included the Berkeley DB library. This has caused me some headaches which I've solved by building and installing BDB v 4.x and including the following at the beginning of the apachecel / httpsdctl file. # fix up problem with C-lib database export LD_PRELOAD=/usr/local/BerkeleyDB.4.0/lib/libdb.so The LD_PRELOAD environment variable to point to the new shared library, Perl will use it instead of the version of Berkeley DB that shipped with your Linux distribution. Maybe this will work for you as well. If you use DBD, make sure and re-install the DBD / DBI modules with the new pointers to the database lib. Michael Robinton BizSystems 4600 El Camino Real - Ste 206 Los Altos, CA 94022 650-947-3351