ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "But, Kelvin-KW" <Kelvin-KW....@AIG.com>
Subject JNDI data source setting for using JDBC transaction manager in iB atis DAO
Date Mon, 13 Dec 2004 10:55:24 GMT
I'd like to seek for more documentation 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="com.policyApp.service.PolicyServiceDaoIF"
implementation="com.policyApp.service.PolicyServiceDaoJdbc"/>
    <dao interface="com.policyApp.service.AuditServiceDaoIF"
implementation="com.policyApp.service.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.

Mime
View raw message