Environment Specific Solutions

Oracle

BLOBs/CLOBs

As of release 2.0.9, iBATIS includes default BLOB/CLOB handlers. If you are using an older version of Oracle (pre-10g), then you might have to write your own Custom Tag Handler to access the proprietary Oracle API to work with LOBs.

Sybase

Stored Proc/UNCHAINED mode

By default, Sybase doesn't allow procs to be run in a transactional context. You can work around this problem a few different ways:

1. Use your own Connection and .setAutoCommit(true). Pass this connection into the SqlMapClient.setUserConnection(Connection) method. You're responsible for closing the connection afterwards. If you like, you can get the Connection from the same DataSource by calling SqlMapClient.getDataSource(). Although this seems a bit "roundabout", it works.

2. In Sybase, use the following command to change all stored procedures into proper transaction mode.

3. Use the longer approach proposed by Scott Severtson: Scott's_Sybase_Proc_Solution

MySQL

Transactions

Older versions of MySQL don't support transactions. Make sure you're using a modern MySQL release and the latest drivers. iBATIS won't work without Transaction support (an RDBMS without TX support is kind of silly anyway).

WebSphere

Global Transaction Configuration

WebSphere is one of the more problematic application servers. It treats global transactions somewhat differently, and tends to mangle local transactions in the process. To make a long story short, here's how to successfully configure iBATIS to work with WAS.

1. Set <transactionManager commitRequired="true">

2. If WAS is complaining about calls to setAutoCommit (false), then you might want to use EXTERNAL transaction management (i.e. not iBATIS JTA). This will allow your app server to declaratively control the transaction completely, with no intervention from iBATIS. However, you may also want to set DefaultAutoCommit to match the app server, and/or tell iBATIS not to setAutoCommit at all by setting SetAutoCommitAllowed to false. Here's an example configuration.

For more information on using WAS with iBATIS read this article on the developerworks website: http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0502cline/

Database_Specific_Information (last edited 2009-09-20 22:57:08 by localhost)