On Wed, 2003-07-16 at 18:32, [EMAIL PROTECTED] wrote:
> I'm confused.
> 
> I have two connections in two processes talking to one Sybase database. Both
> connections are connected as AutoCommit => 0.

<snip>

> The stored proc internally does a BEGIN TRANACTION, an update and a COMMIT. The
> process containing connection 1 then moves on to otehr tasks and does not use
> connection 1 again.
> 
> Connection 2 tries to do the same thing and is blocked.

The default behavior of DBD::Sybase in AutoCommit OFF mode is to issue a
BEGIN TRAN before sending the first command. Therefore, because your
stored proc issues it's own BEGIN TRAN/COMMIT the complete transaction
will only finish when you run $dbh->commit() on that connection as you
have nested transactions and the whole thing can still be rolled back if
the outermost transaction is rolled back.

You should investigate using the "chained" transaction mode (see the
syb_chained_txn attribute) as this is the native AutoCommit flag for
OpenClient.

See also the sp_procxmode system stored procedure, which you can use to
mark your procs for different execution modes (chained, unchained, or
any mode).

BTW - I think that the "chained" mode for AutoCommit "off" should really
be the default. The fact that it isn't is really an accident of history.

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
[EMAIL PROTECTED]                 http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.mbay.net/~mpeppler/resume.html

Reply via email to