Did anyone get to review the comments I made and attachments for this JIRA issue.

~ Shreyas

Shreyas Kaushik (JIRA) wrote:

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


 I have attached the changes I did to parameterMapping.java and the output I 
got. It is slightly tricky to figure out the failures when they occur for 
certain datatypes with the setNull method with batching turned on.

 Firstly, I want to confirm the addition I did to the test is fine. If the 
additions are fine then I can start to figuring out which tests failed ( with 
batching turned on ) but are supposed to pass. The only way I found was 
comparing the output, the addition to the test case produces with the output 
got when batching is not performed, i.e comparing the output of executeUpdate() 
with executeBatch().

 A peek into the output file I have attached will give a clearer picture of 
what I am trying to say. Correct me if I am wrong or suggest a better way to 
detect failures than what I am doing.



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
   Assignee: Shreyas Kaushik
Attachments: parameterMapping.out, testChanges.diff

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