Selvakumar has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am using the below code and i am getting error. How to solve this? i cannot understand this error also.
DBD::DBM::st execute failed: Cannot open .\Reference.lck: No such fil +e or directory at C:/Perl/lib/DBD/File.pm line 574. [for Statement " Select * from Reference"] at DataBaseControl.pl line 22. DBD::DBM::st execute failed: Cannot open .\Reference.lck: No such fil +e or directory at C:/Perl/lib/DBD/File.pm line 574. [for Statement " Select * from Reference"] at DataBaseControl.pl line 22.
use strict; use warnings; use DBI; my ($dbh, $sth); my $Error_Message = "\nThere Was A Problem Connecting To The Database\ +n"; my $driver = 'DBM'; # e.g., mysql or ODBC or ??? my $dbusername = 'sa'; my $dbpassword = 'admin'; my $server = 'localhost'; my $database = 'Copyediting'; $dbh = DBI->connect("dbi:$driver:$database:$server", $dbusername, $dbp +assword, {'RaiseError' => 1, 'PrintError' => 1} ) || die "$Error_Message $DBI::errstr"; $dbh->{RaiseError} = 1; for my $sql( split /;\n+/," Select * from Reference; "){ my $sth = $dbh->prepare($sql); $sth->execute; $sth->dump_results if $sth->{NUM_OF_FIELDS}; } $dbh->disconnect();
Also i don't what driver needs to specify here? I have the below driver in my system using this code.
@driver_names = DBI->available_drivers;
DBM ExampleP File ODBC Proxy SQLite Sponge mysql
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sql server database connectivity error
by cdarke (Prior) on Sep 21, 2009 at 10:53 UTC | |
|
Re: sql server database connectivity error
by roboticus (Chancellor) on Sep 21, 2009 at 17:34 UTC | |
by afoken (Chancellor) on Sep 23, 2009 at 04:35 UTC |