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

Hi all, I can connect to my database fine (I think) but can't execute the statements.
The error I get is
DBD::DBM::st execute failed: Execution ERROR: Cannot open /Users/action_type.lck: No such file or d +irectory (2) at /usr/local/ActivePerl-5.20/lib/DBI/DBD/SqlEngine.pm l +ine 1589. . [for Statement "select distinct action_type, description from action_ +type "] at LoadACtionType.pl line 11. Cannot execute the statement Execution ERROR: Cannot open /Users/action_type.lck: No such file or d +irectory (2) at /usr/local/ActivePerl-5.20/lib/DBI/DBD/SqlEngine.pm l +ine 1589.
#!/usr/bin/perl use strict; use Data::Dumper; use DBI; my $dbh = DBI->connect('DBI:DBM:PRO','username','password') or die "Co +uldn't connect to the database ". DBI->errstr; my $sth_action = $dbh->prepare('select distinct action_type, descripti +on from action_type ') or die 'Cannot prepare the statement'. $dbh->e +rrstr; $sth_action->execute or die 'Cannot execute the statement '. $sth_acti +on->errstr;
I couldn't figure out what I am doing wrong. Could someone help me please.

Replies are listed 'Best First'.
Re: Execution Error DBI usr/.lck
by poj (Abbot) on Jan 27, 2015 at 18:04 UTC

    Where are the action_type.* files located ?

    You can specify the location with

    my $dbh = DBI->connect('dbi:DBM:PRO','','', { f_dir => '/path/to/database' });
    poj
      A quick look I see the module is trying to create the lock file under the /users. Something is wrong with your profile setting. The lock file should be created under /users/<username>. You would not have write access to create the file under /users.
      Cheers,
      HP
        Sorry its trying to write in one of my directory its under /user/<username>/Perl/Scripts/. Sorry I edited some part of it . cheers