D
dima
Hello all
I have one problem with DBI module.
This is the description of my problem:
I try to prepare and execute one sql statement ($sql1) and it's ok, but
when I try to prepare and execute second sql statement ($sql2) and not
finish first I get this error:
DBD::ODBC::db prepare failed: (DBD: st_prepare/SQLPrepare err=-1) at
line ...
Can't prepare statement: (DBD: st_prepare/SQLPrepare err=-1) at line
....
Can someone help my?
This is my script:
use strict;
use DBI;
my $dbh;
my $msuser = 'test';
my $mspasswd = 'test';
$dbh = DBI->connect('dbi:ODBC:mssql', $msuser, $mspasswd);
my $sql1 = qq{SELECT * FROM CallDetailRecord;};
my $sql2 = qq{SELECT * FROM CallDetailRecord;};
my $sth1 = $dbh->prepare($sql1) or die("Can't prepare statement:
$DBI::errstr");
my $rc1 = $sth1->execute() or die("Can't execute statement:
$DBI::errstr");
#$sth1->finish();
my $sth2 = $dbh->prepare($sql2) or die("Can't prepare statement:
$DBI::errstr");
my $rc2 = $sth2->execute() or die("Can't execute statement:
$DBI::errstr");
#$sth2->finish();
$dbh->disconnect if ($dbh);
I have one problem with DBI module.
This is the description of my problem:
I try to prepare and execute one sql statement ($sql1) and it's ok, but
when I try to prepare and execute second sql statement ($sql2) and not
finish first I get this error:
DBD::ODBC::db prepare failed: (DBD: st_prepare/SQLPrepare err=-1) at
line ...
Can't prepare statement: (DBD: st_prepare/SQLPrepare err=-1) at line
....
Can someone help my?
This is my script:
use strict;
use DBI;
my $dbh;
my $msuser = 'test';
my $mspasswd = 'test';
$dbh = DBI->connect('dbi:ODBC:mssql', $msuser, $mspasswd);
my $sql1 = qq{SELECT * FROM CallDetailRecord;};
my $sql2 = qq{SELECT * FROM CallDetailRecord;};
my $sth1 = $dbh->prepare($sql1) or die("Can't prepare statement:
$DBI::errstr");
my $rc1 = $sth1->execute() or die("Can't execute statement:
$DBI::errstr");
#$sth1->finish();
my $sth2 = $dbh->prepare($sql2) or die("Can't prepare statement:
$DBI::errstr");
my $rc2 = $sth2->execute() or die("Can't execute statement:
$DBI::errstr");
#$sth2->finish();
$dbh->disconnect if ($dbh);