Support for Sybase database Transaction modes in JDBC Adapter
Vinod_Valecha 270002HC72 Visits (6591)
In this blog post we will see in the detail both the transaction modes, since lot of times it becomes confusing to deal with them.
Unchained mode: specified by JDBC's Conn
Chained mode: specified by JDBC's Conn
An understanding of these transaction modes is important for JDBC adapter since a Stored procedures written to use the unchained transaction mode may be incompatible with other transactions using chained mode, and vice-versa.
For example, here is a valid stored procedure using chained transaction mode
create proc myproc
insert into books
values ("9996", null, null, null)
A program using unchained transaction mode would fail if it called this procedure because the commit does not have a corresponding begin.As a rule, applications using one transaction mode should call stored procedures written to use that mode.
Adaptive Server tags all procedures with the transaction mode (chained or unchained) of the session in which they are created. This helps avoid problems associated with transactions that use one mode to invoke transactions that use the other mode. A stored procedure tagged as "chained" is not executable in sessions using unchained transaction mode, and vice-versa.
Unchained and Chained modes are mostly mutually exclusive. Unless a stored procedure is written with care to support both modes, it will generally only work in one mode. JDBC's transactional support requires Conn
The JDBC Adapter uses the chained mode by default. Adapter provides a configurable property "Set Auto Commit on Database Connection" that should switch to unchained mode when the property is set to true.
Hope the above information will help you when dealing with transaction modes for Sybase database.