my java application is trying to run an insert query to an oracle DB. the table i am inserting to has a DATE field called last_modified my query uses Timestamp, while counting on the oracle to convert to date field. every day at 23:00 i get the following error
java.lang.RuntimeException: **Assertion botch: negative time**
at
oracle.jdbc.driver.DateCommonBinder.setOracleHMS(OraclePreparedStatement.java:18740)
at
oracle.jdbc.driver.TimestampBinder.bind(OraclePreparedStatement.java:19245)
at
oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:3014)
at
oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9973)
at
oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:213)
i have checked the time zones using:
SELECT SYSTIMESTAMP, CURRENT_TIMESTAMP, DBTIMEZONE, SESSIONTIMEZONE FROM DUAL;
i got: 05-JUN-13 08.09.29.244232 AM +02:00, 05-JUN-13 08.09.29.244236 AM +02:00, +00:00,+02:00
the client mochine( the one on which i have the java application) and the DB machine are the same one. but still i get the java.lang.RuntimeException: Assertion botch: negative time
my questions are:
how can i add to my code a catch block that will avoid the need to restart my application every day at 23:00 ? it seems to me that the exception is an java.lang.RuntimeException and i cant add catch(java.lang.RuntimeException e) or can i ?
is the Assertion botch: negative time an assertion ? can i catch it using catch (java.lang.AssertionError e) ?
Had the same problem. We fixed it by using vm parametr to explicitly set Java timezone.
-Duser.timezone=<yourTZ>
This is a strange bug, when Date objects are correct on the other end, but still bug when time falls into TZ gap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With