Hi there --- first of all I am new to Perl - so pls be patient :)
Having trouble with DBD Sybase trying to start a transaction in the code, getting this error
DBD::Sybase::db begin_work failed: Already in a transaction..
Syb OpenClient Ver:
Sybase Client-Library/12.5.1/P-EBF16000 ESD #24/DRV.12.5.1.10/Linux x86_64/Linux 2.4.21-47.0.1.ELsmp x86_64/BUILD1251-055/OPT/Thu Jul 3 19:37:33 2008
Perl version: This is perl,
v5.10.0 built for x86_64-linux-thread-multi
Syb ASE Ver:
Adaptive Server Enterprise/12.5.4/EBF 14919 ESD#7/P/Sun_svr4/OS 5.8/ase1254/2093/64-bit/FBO/Thu Oct 11 09:25:36 2007
...i am trying to execute a sp, lets say 100 times that inserts some records to the database, and , only if all 100 times are successfull --- then commit, else rollback ...
Here is the code... Any help is appreciated !! THANK YOU!!
#!/efs/dist/perl5/core/5.10/exec/bin/perl
use EFSPerl::Version 'DBI' => '1.607', 'DBD-Sybase' => '1.09';
use 5.010;
use DBI qw(:sql_types);
my %attr = ( 'RaiseError' => 1,
'PrintError' => 0,
'ChopBlanks' => 1,
'AutoCommit' => 0,
);
print "establishingh connection\n";
my $dbh = DBI->connect("dbi:Sybase:server=ETMA_NYDEV_DS;database=some_
+db","some_uid","some_pwd", \%attr);
print "preparing call to PerlTest sp\n";
my $sth = $dbh->prepare("exec PerlTest2 \@RetVal = ? OUTPUT, \@SomePar
+am = ? ");
print "starting transaction\n";
$dbh -> begin_work; # <<<<< error here .... DBD::Sybase::db begin_w
+ork failed: Already in a transaction
$sth->bind_param(1, undef, SQL_INTEGER);
$sth->bind_param(2, "val1", SQL_VARCHAR);
print "executing...\n";
$sth->execute;
print "rolling back...\n";
# lets rollback
$dbh->rollback;
print "finishing...\n";
$sth -> finish;
$dbh->disconnect;
close dbh;
print "----disconnected------\n";
exit 0;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.