>From a quick look at what you have posted, your setNull should look like following
insertPreparedStatement.setNull(5,Types.TIMESTAMP).
If you look at java.sql.Types, you will see that Types.NULL is int 0 under the covers
and the error you are getting is because Derby is trying to extract TIMESTAMP value
from 0.
Mamta
Jeremiah Jahn wrote:
> Am I on crack or shouldn't this work?
>
> insertPreparedStatement.setNull(5,Types.NULL); where column is a
> timestamp column.
>
> This is with the latest official release(10.0.2.1). running on java 5
> and linux.
>
> SQL Exception: An attempt was made to get a data value of type 'TIMESTAMP' from a data value of type '0'.
> 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.setNull(EmbedPreparedStatement.java)
> at com.goodinassociates.evidencetracking.functionaltests.DatabaseTestHelper.prepareEventTable(DatabaseTestHelper.java:383)
> at com.goodinassociates.evidencetracking.functionaltests.DatabaseTestHelper.prepareCaseEvidenceTable(DatabaseTestHelper.java:500)
> at com.goodinassociates.evidencetracking.main.MainControllerTest.testMain(MainControllerTest.java:40)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
>
> Be different: conform.
>
> ------------------------------------------------------------------------------------------------------------------------
> Name: signature.asc
> signature.asc Type: application/pgp-signature
> Description: This is a digitally signed message part