I am planning to work on this may be this week, but definitely next week. I did a similar fix for Blob and Timestamp. But as a part of the patch for this I want to solve this problem not just for this specific case but for all DataTypes where this problem could occur.

~ Shreyas

Shreyas Kaushik (JIRA) wrote:

[ http://issues.apache.org/jira/browse/DERBY-203?page=comments#action_63028 ]
Shreyas Kaushik commented on DERBY-203:
---------------------------------------


I had fixed smilar problem with Blob and Timestamp. I will look into this and 
other types with which this problem can arise.



setNull(x,JDBCType.DATE) does not work when batching is turned on
-----------------------------------------------------------------

Key: DERBY-203
URL: http://issues.apache.org/jira/browse/DERBY-203
Project: Derby
Type: Bug
Components: JDBC
Versions: 10.0.2.1
Environment: ------------------ Java Information ------------------
Java Version: 1.4.2_07
Java Vendor: Sun Microsystems Inc.
Java home: /usr/local/java/j2sdk1.4.2_07/jre
Java classpath: /home/oleg/prg/cs/lib/derby.jar:/home/oleg/prg/cs/lib/derbytools.jar:
OS name: Linux
OS architecture: i386
OS version: 2.6.8.1-24mdk
Java user name: oleg
Java user home: /home/oleg
Java user dir: /usr/local/home/oleg/prg/cs/frameworks/embedded/bin
--------- Derby Information --------
[/usr/local/home/oleg/prg/cs/lib/derby.jar] 10.0.2.0 - (30301)
[/usr/local/home/oleg/prg/cs/lib/derbytools.jar] 10.0.2.0 - (30301)
------------------------------------------------------
----------------- Locale Information -----------------
------------------------------------------------------
Reporter: Oleg Anastasyev





Trying to execute batch on which setNull(x,DATE) was called gives the following exception:
SQL Exception: An attempt was made to get a data value of type 'DATE' from a data value of type 'null'.
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(EmbedConnection.java)
at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(ConnectionChild.java)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.dataTypeConversion(EmbedPreparedStatement.java)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setObject(EmbedPreparedStatement.java)
at org.apache.derby.iapi.types.DataType.setInto(DataType.java)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeBatchElement(EmbedPreparedStatement.java)
at org.apache.derby.impl.jdbc.EmbedStatement.executeBatch(EmbedStatement.java)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
DATE column is nullable in db schema, so it should pass there ok. I believe the problem is in org.apache.derby.iapi.types.SQLDate, which does not implement setInto method, so DataType.setInto method is executed, calling setObject(x,null). setObject thinks this is JDBC spec violation and fails on exception.
Problem exists in both 10.0.2.1 and 10.0.2.0





Reply via email to