PS: Websphere will also cause some problems. Be sure to use iBATIS
2.0.8 or higher, and set commitRequired="true" in the config settings.
Lucky you, Sybase and WebSphere.... ;-)
Cheers,
Clinton
On Wed, 15 Dec 2004 07:36:19 -0700, Clinton Begin
<[EMAIL PROTECTED]> wrote:
> Yuck. This drives me nuts about Sybase. Anyway, you have to run
> certain stored procs in AutoCommit mode, which by design, iBATIS does
> not support. There are a number of threads in the old sourceforge
> archives regarding this. Try searching the old dev and user groups
> for "UNCHAINED" and you will find them.
>
> A solution i can think of is to just grab a connection (from JNDI
> datasource, from SqlMaClient, or from anywhere), set autocommit true,
> and then call SqlMapClient.setUserConnection() or
> openSession(Connection) to configure it manually for autocommit.
>
> Cheers,
> Clinton
>
>
> On Wed, 15 Dec 2004 09:32:31 +0800, But, Kelvin-KW
> <[EMAIL PROTECTED]> wrote:
> >
> >
> > I'd like to seek for more information on how to configure proper JNDI data
> > source setting for using JDBC transaction manager in iBatis DAO. I
> > encounter this error when my DAO JDBC implementation execute a stored
> > procedure:
> >
> > [12/13/04 18:16:12:188 CST] 40362530 SystemErr R
> > com.sybase.jdbc2.jdbc.SybSQLException: Stored procedure
> > 'aidcconfig..po_uam_get_user' may be run only in unchained transaction mode.
> > The 'SET CHAINED OFF' command will cause the current session to use
> > unchained transaction mode.
> >
> > We're using iBatis 2.0.8.470, WASD 5.1 and Sybase ASE 12.5. In WebSphere
> > 5.0 (embedded in my WASD 5.1), I have defined a normal Sybase data source
> > with JNDI name using Sybase JConnect 5.5 JDBC Driver. In web.xml, I have
> > defined a resource reference to point to the Websphere JNDI entry. The
> > store procecedure po_uam_get_user has just some simple select statements
> > without "begin tran" or "commit" command.
> >
> > But when I comment out "connection.setAutoCommit(false)" statement in the
> > com.ibatis.dao.engine.transaction.jdbc.JdbcDaoTransaction.java, the error
> > disappears and my java program can select correct data from Sybase.
> >
> > Does it related to my data source or web.xml setting? Or related to whether
> > I use XA driver or not?
> >
> > Provided that above can be solved, I would like to know further that how can
> > I achieve two-phase commit capability via iBatis DAO with the following
> > dao.xml and statements. I have no idea of what type of configuration I have
> > to make on my application server.
> >
> > <context>
> > <transactionManager type="JDBC">
> > <property name="DataSource" value="JNDI"/>
> > <property name="DBJndiContext"
> > value="java:comp/env/jdbc/policy"/>
> > </transactionManager>
> > <dao interface="PolicyServiceDaoIF"
> > implementation="PolicyServiceDaoJdbc"/>
> > <dao interface="AuditServiceDaoIF"
> > implementation="AuditServiceDaoJdbc"/>
> > </context>
> >
> > private DaoManager daoManager = DaoConfig.getDaomanager();
> >
> > policyDao = (PolicyServiceDaoIF)
> > daoManager.getDao(PolicyServiceDaoIF.class);
> > auditDao = (AuditServiceDaoIF)
> > daoManager.getDao(AuditServiceDaoIF.class);
> >
> > try {
> > daoManager.startTransaction();
> >
> > policyDao.addPolicy(policy);
> > auditDao.log("addPolicy - " + policy.getPolicyId());
> >
> > daoManager.commitTransaction();
> > } finally {
> > daoManager.endTransaction();
> > }
> >
> > Looking forward to your reply.
> >
> > Regards,
> > Kelvin But
> >
> > IMPORTANT NOTICE:
> >
> > The information in this email (and any attachments) is confidential.
> > If you are not the intended recipient, you must not use or disseminate the
> > information.
> > If you have received this email in error, please immediately notify me by
> > "Reply" command
> > and permanently delete the original and any copies or printouts thereof.
> > Although this email and any attachments are believed to be free of any virus
> > or
> > other defect that might affect any computer system into which it is received
> > and opened,
> > it is the responsibility of the recipient to ensure that it is virus free
> > and no responsibility
> > is accepted by American International Group, Inc. or its subsidiaries or
> > affiliates either
> > jointly or severally, for any loss or damage arising in any way from its
> > use.
>