ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Nunn" <peter.n...@emap.com>
Subject ClobTypeHandlerCallback For Oracle 9i
Date Wed, 09 Feb 2005 17:42:45 GMT
I've been trying (for a while now) to implement a TypeHandlerCallback that can WRITE clobs
under Oracle 9i. It appears that this isn't possible. If anyone has a solution to this then
I'd be grateful for your assistance. Up to now I haven't seen a workable solution.

So far I have tried the following:

1) Call setter.setString(s). 

This fails because setString(x) has an upper limit of 4K. 

2) Call setter.setCharacterStream(reader, s.length()). i.e. use same approach as 2.0.9 ClobTypeHandlerCallback

This doesn't work either.

3) Attempt to work with Oracle extension, namely oracle.sql.CLOB. The preferred solution.

This isn't possible because you cannot create an instance of oracle.sql.CLOB directly. You
need to either:

a) create a temporary CLOB via a call to CLOB.createTemporary(...). This requires a Connection
object. Since ParameterSetter doesn't expose the PreparedStatement we cannot get hold of the
Connection object. So this approach is a non-starter. Even if we did have the connection things
aren't straightforward because we need an OracleConnection... which you won't have if you
are using a DataSource to obtain your connections.

b) execute a SELECT statement to obtain a ResultSet then obtain the CLOB instance by calling
ResultSet.getClob("field"). This clearly isn't an option from within a TypeHandlerCallback.

I'd really appreciate some help here... I've hit a brick wall. As of now I've come to the
conclusion that iBatis cannot handle CLOBS in Oracle prior to 10g. This is clearly an issue.

So the only remaining option is to write a JDBC Dao implementation and bypass SQLMAPS...any
improvements upon this?

Peter Nunn
Senior Java Developer
Telephone: 020 7017 3601
Mobile: 07866 670 530

** For Emap magazine subscriptions & gift offers visit http://www.greatmagazines.co.uk/emap

The information in this email is intended only for the addressee(s) named above.  Access to
this email by anyone else is unauthorised.

If you are not the intended recipient of this message any disclosure, copying, distribution
or any action taken in reliance on it is prohibited and may be unlawful. 

Emap plc and or its subsidiaries do not warrant that any attachments are free from viruses
or other defects and accept no liability for any losses resulting from infected email transmissions.

Please note that any views expressed in this email may be those of the originator and do not
necessarily reflect those of this organisation.

View raw message