You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Avril Kotzen <ak...@concordetravel.co.za> on 2004/02/05 14:46:30 UTC

DB2 Universal JDBC Driver Considerations

Hi
 
I have just encountered another scenario that needs special treatment
when using the DB2 Universal JDBC Driver. I'm working with DB2 8.1. The
treatments are specified in PlatformDb2Impl in method
setObjectForStatement(... Thank goodness for this PlatformImpl design.
I'm not at all sure how these problems would have been solved without
it.
 
So far there seem to be 4 data types that may need different treatment. 
 
For both the old (type 2) and the newer type 4 driver check for:

*	JDBC type TINYINT (already in). Actually haven't tested if it is
still necessary with the universal driver.
*	JDBC type DECIMAL. Jason Mihalick provided a fix, but it does
not seem to make it into the new releases. Refer to
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.o
rg&msgId=756816

Things that worked with the type 2 driver but not with the type 4.

*	JDBC type of LONGVARCHAR. Need to cast the object being set to a
String. ---ps.setString(index, (String) value);
*	JDBC type BIT. No changes are needed  if the related column is
defined as SMALLINT. No changes are needed if the related column is
defined as CHAR(1) and the boolean is never used for selection criteria.
However if the related column is CHAR and is part of selection criteria
a SQLException is thrown (SQLCode = -301). To get round this problem ---
ps.setObject(index, value, Types.CHAR); Please note that if booleans are
mapped as both SMALLINT and CHAR this code will not work for SMALLINT
mappings and selection criteria.   

Has anyone else come across this problem with BIT?  I think it would be
good if the DECIMAL treatment could be made permanent. Those changes
that are dependent on driver versions and database definitions should
probably only be commented. 
 
Let's hope that there are not more to be found.
 
Regards
Avril