ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zsolt" <zkoppanyl...@intland.com>
Subject RE: iBATIS with the embedded Derby JDBC driver
Date Tue, 10 Oct 2006 07:09:36 GMT
Thank you Jeff,


Why is that necessary if I pass (java.lang.Integer)null?





From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Monday, October 09, 2006 4:34 PM
To: user-java@ibatis.apache.org
Subject: Re: iBATIS with the embedded Derby JDBC driver


If a column can be null, then you need to specify the JDBC type in the
mapping.  For example:


<insert ...>

  insert into sometable (id, desc)

  values(#id:INTEGER#, #desc:VARCHAR#)


This is true for all the DB2-like databases.


Jeff Butler



On 10/9/06, Zsolt <zkoppanylist@intland.com> wrote: 


Our product uses the services of iBATIS and we are using MySQL for the
database layer. We recently tried out the Derby database engine and we 
were mainly successful.

We have an issue though, which seems to be related to iBATIS. While
things are under control with the networked Derby JDBC driver, the
embedded Derby JDBC driver does not work and we systematically receive 
the following stack trace pattern:

java.sql.SQLException: An attempt was made to get a data value of type
'VARCHAR' from a data value of type '0'.

Based on discussions with the Derby team, the problem seems to appear
due to a misbehaving iBATIS call. More specifically, the
java.sql.PreparedStatement.setNull(int parameterIndex, int sqlType) 
call seems to be always made with the sqlType argument being 0 instead
of the type of the parameter.

We are using iBATIS We did not dive into the iBATIS source
code but instead thought to ask here. Is this a known issue? 



View raw message