AutoCommit + Perl + Oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • noctech
    New Member
    • Apr 2007
    • 1

    AutoCommit + Perl + Oracle

    Hi, Anyone having idea how to disable autocommit while executing query with perl. I am using oracle 9i and perl 5.8 but when ever i execute any update query it autocommit.
    +++++++++++++++ +++++++ Below is wht i am doing for disabling it +++++++++++++++ ==
    #!/Opt/perl64/bin/perl
    use DBI;
    $dbh = DBI->connect('DBI:O racle:iobastst' ,'nidhitabs','n idhitabs',{Auto Commit => 0}) or die "Couldn't connect to database: " . DBI->errstr;
    $dbh->{AutoCommit} = 0;
    $sth = $dbh->prepare("nse rt into cams_file_mv_st atus values ('$data1','$!', '$data')") or die "Couldn't prepare statement: " . $dbh->errstr;) or die "Couldn't prepare statement: " . $dbh->errstr;
    $sth->execute();
  • kershell
    New Member
    • Apr 2007
    • 11

    #2
    Originally posted by noctech
    Hi, Anyone having idea how to disable autocommit while executing query with perl. I am using oracle 9i and perl 5.8 but when ever i execute any update query it autocommit.
    +++++++++++++++ +++++++ Below is wht i am doing for disabling it +++++++++++++++ ==
    #!/Opt/perl64/bin/perl
    use DBI;
    $dbh = DBI->connect('DBI:O racle:iobastst' ,'nidhitabs','n idhitabs',{Auto Commit => 0}) or die "Couldn't connect to database: " . DBI->errstr;
    $dbh->{AutoCommit} = 0;
    $sth = $dbh->prepare("nse rt into cams_file_mv_st atus values ('$data1','$!', '$data')") or die "Couldn't prepare statement: " . $dbh->errstr;) or die "Couldn't prepare statement: " . $dbh->errstr;
    $sth->execute();
    Disconnecting from a database may cause outstanding changes to be committed. This has nothing to do with DBI. It depends on the RDBMS. If you do not wish to commit the changes call $dbh->rollback() before calling $dbh->disconnect() .

    Another advice is to use $dbh->do() for non-SELECT statements. It is simpler. :-)

    Comment

    Working...