|
Problem |
When an application running in WebSphere® Application
Server 4.0.x calls a Sybase® stored procedure in unchained (autocommit)
mode, the following exception is issued:
com.sybase.jdbc2.jdbc.SybSQLException: Stored procedure 'xxx' maybe run
only in unchained transaction mode |
|
Cause |
In Sybase, a stored procedure can be defined in either
chained or unchained mode. When it is in unchained mode, AutoCommit must
be set to true to ensure that the connection is also in unchained
mode. |
|
Solution |
There are two ways to resolve the problem:
- Run the Sybase isql command:
sp_procxmode <procedure_name>,"anymode"
This command causes the stored procedure to ignore whether it is run in
chained or unchained mode. The exception is not issued.
- Call the method setAutoCommit(true) on the connection object. The
setAutoCommit() method cannot be called within a transaction. If it is
done within an EJB™, the EJB method must have the transaction attribute of
TX_NOT_SUPPORTED so that it is called without a transaction context.
Running stored procedures in unchained mode is not recommended. If any
of the statements in the stored procedure fail, the transaction cannot be
rolled back to a known state because some statements in the stored
procedure are already committed.
|
|
|
|
|
|
|