Berkley DB Query.

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

21-Feb-00 17:24
Howdy,
I have a perl script running through Apache on Caldera Linux, and I'm getting problems with the line below.

tie %data, "DB_File", 'jobs.db', O_RDWR |O_CREAT, 0666 or die "Can't open jobs.db: $!\n";

This prints the error to the apache errorlog

Can't open jobs.db: file exists

It does and i've set it to 777 to make sure my permissions weren't the problem. I'm sure DB_File is supposed to be able to open existing files.
I know I'm doing something wrong I've checked my permissions again and again, but it's not helped.
The Read/write flag is set and so is the create flag.
Has anyone had experiences like this, or does anyone know a way around it, I've tried it on two servers, my own and a commercial one and I get the same error. both were running apache and Perl 5.
Incase you need it here's the code before that line.
------------ Code ----------------
#!/usr/bin/perl -w

use strict;
use DB_File;
use CGI qw(:standard);
use vars qw(@fields);
require "./html.pl";
require "./fields.pl";
my $header = &html_header;
my $footer = &html_footer;
&no_params unless param();
my $id = param('id');
my(%data, %in);
------------ End Code --------------

I've another completely unrelayted question as well. This forum, is it written by elated?, or is it a commercially available product.

Cheers,

Steve.
22-Feb-00 09:34
Hi Steve,

Matt from Elated here. I must say I've never used DB_File, so I'm not that familiar with it! The only thing I can suggest is that you might need to include the line:

use Fcntl;

in order to define the values O_RDWR and O_CREAT. Don't know if this would affect the result though. Have you tried omitting the parameters on the end, i.e. just use:

tie %data, "DB_File", 'jobs.db';

to see if it runs with the defaults OK?

Let us know how you get on. Does anyone else have any suggestions?

The next question is much easier for me to answer: the forum software is indeed written by Elated!

cheers,
Matt


<font face="Verdana,Arial,Helvetica,Sans-serif" size=-1 color=#ff0000>Edited by matt on Tue Feb 22 09:37 2000</font>

--
Matt Doyle, Elated
3rd Edition of my jQuery Mobile book out now! Learn to build mobile web apps. Free sample chapter: http://store.elated.com/

 
New posts
Old posts

Follow Elated