[ 
http://issues.apache.org/jira/browse/DERBY-203?page=comments#action_65856 ]
     
Daniel John Debrunner commented on DERBY-203:
---------------------------------------------

Patch committed - svn revision 171115

Use explicit setXXX methods for binary, DATE and TIME types when setting
a DataValueDescriptor into a PreparedStatement. Replaced the use of setObject
for these types which lead to un-typed NULLs being set into a PreparedStatement.

Patch contributed by Shreyas Kaushik <[EMAIL PROTECTED]>

> 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.diff, parameterMapping.out
>
> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to