db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: 'VARCHAR' from a data value of type '0'
Date Wed, 05 Jul 2006 08:00:23 GMT
Eike Stepper <stepper@sympedia.com> writes:

> Knut Anders Hatlen schrieb:
>> Eike Stepper <stepper@sympedia.com> writes:
>>
>> [...]
>>
>> It seems like setNull() is called with 0 as type id (second argument)
>> at line 95 in StatementCreatorUtils.java. It should work if you change
>> the type id to java.sql.Types.VARCHAR.
>
> Hi Knut,
>
> Thx for your quick reply.
> Unfortunately the call to setNull() is in the Spring Framework,
> which I can't change ;-(

How do you supply the null to Spring? There should be a way to tell
Spring to use the correct type id.

My guess after looking at your stack trace and the Spring code, is
that org.eclipse.emf.cdo.server.impl.MapperImpl.sql() invokes the
org.springframework.jdbc.core.JdbcTemplate.update() method with two
parameters (String sql, Object[] args). There is also an update method
with three parameters (String sql, Object args[], int[] argTypes). You
could try to use that one instead.

> Isn't it confusing that the same application did properly work with
> mysql and hsqldb drivers?

MySQL and HSQLDB ignore the sqlType parameter. That's valid behaviour,
but not required (otherwise, the JDBC spec wouldn't have included that
parameter). If the application supplies an incorrect parameter to a
JDBC method, it might fail with some drivers and work with others, but
that's an application problem, not a driver problem.

> Could the problem also be caused by a bug in the Derby
> PreparedStatement implementation?
> Type id '0' returned instead of java.sql.Types.VARHAR...

I don't think so. PreparedStatement.setNull() receives a type id from
Spring, it doesn't return one.

-- 
Knut Anders

Mime
View raw message