punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
Mercurial Monks,
Time flies like an arrow. Fruit flies like a banana.
I'm having a little trouble with accessing an old DBM file using DBI.
We have an old DBM file:
I simply want to see what's in it. Thought the DBI would be a good way, so:data.pag data.dir
But what I get is#!/usr/bin/perl -w use strict; use warnings; use DBI; use CGI; use CGI::Carp qw(fatalsToBrowser); # start error output BEGIN { use CGI::Carp qw(carpout); carpout(*STDOUT); } print "Content-type:text/html\n\n"; my $db_name = 'data'; my $dbh = DBI->connect('dbi:DBM(RaiseError=1):'); my $sqlSelect = "SELECT * FROM $db_name"; my $sth = $dbh->prepare($sqlSelect) || die "Cannot prepare: " . $dbh-> +errstr(); $sth->execute() or die "Cannot execute: " . $sth->errstr(); while (my @data = $sth->fetchrow_array()) { print "<br>"; for my $i (0 .. $#data) { print ", $data[$i]\n"; } } $sth->finish;
For the record - both the files are chmod'd 755.Software error: DBD::DBM::st execute failed: Execution ERROR: No write permission to sdbm file at /bla/bla/bla/DBD/ +DBM.pm line 422. . at /bla/bla/bla/DBI/DBD/SqlEngine.pm line 1234. [for Statement "SELECT * FROM pmb_passwords_dbm"] at dumpmydbm.pl lin +e 26.
Now, I was previously getting the error "no lck file" - so I simply created an empty data.lck file and that seemed to shut that up.
What's up?
Thanks.
Time flies like an arrow. Fruit flies like a banana.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Accessing old DBM file with DBI - "write permission"?
by punch_card_don (Curate) on Mar 05, 2013 at 18:38 UTC | |
by Laurent_R (Canon) on Mar 05, 2013 at 18:47 UTC | |
by punch_card_don (Curate) on Mar 05, 2013 at 19:24 UTC |
Back to
Seekers of Perl Wisdom