I have written a simple java program that inserts database records into a database. The program works most of the time but I occassionaly get the error:
Runtime exception: java.lang.RuntimeException: Assertion botch: negative time
My java machine is on the Central Time zone and the database itself is on Pacific Time zone.
I did some research online and one person said this problem is time zone related but I did not understand how to fix the problem.
The record that I time trying to insert is this one:
Record that causes the exception is as follows:
ExceptionRecord [hostname=lion.odc.vzwcorp.com, logFile=/log/srv01_epb02/SystemOut.log, time=1/24/14 23:53:47:491 PST, exception=org.springframework.web.util.NestedServletException:]
It depends on what database and JDBC driver you are using. Some of them understand time zones and work properly regardless of differences between the client and server, and others don't. I remember that Microsoft SQL Server fell in the latter group and I had to write some really awful code to map my timestamps to GMT on its behalf.
posted 3 years ago
I figured out the problem. I was converting a date field from a log file into a java timestamp object. There is was a bug in the code and dates like 1/24/14 were treated like the date on January 24 on year 14 instead of year 2014. Once I corrected the convertion problem, my Oracle exception went away.