in reply to DBD Sybase Transaction begin_work fails

If you read the DBI documentation for begin_work, it says:

Enable transactions (by turning AutoCommit off) until the next call to commit or rollback. After the next commit or rollback, AutoCommit will automatically be turned on again.

So why are you calling it? When your create your connection, you've already disabled autocommit with

 'AutoCommit' => 0,

I suspect the failure is happening because you are calling begin_work after you have created a statement handle with $dbh->prepare.

Replies are listed 'Best First'.
Re^2: DBD Sybase Transaction begin_work fails
by ikegami (Patriarch) on Sep 15, 2009 at 16:48 UTC

    Another way of putting it is that $dbh->{AutoCommit} = 0; and $dbh->begin_work; are two ways of starting a transaction.

    I suspect the failure is happening because you are calling begin_work after you have created a statement handle with $dbh->prepare.

    No, the error occurs because transactions aren't nestable, at least not in DBI.

Re^2: DBD Sybase Transaction begin_work fails
by vcoderv (Initiate) on Sep 15, 2009 at 16:59 UTC
    Hi , with AutoCommit -> 0, I removed begin_work but the rollback, at the end did not actually rollback anything, stored proc created records... but the records were only supposed to be kept if i committed.. but i rolled back..