Thursday, September 18, 2008

Re: [JDBC] Bad Timestamp Format at 23 in 2008-09-16 18:41:00.479

I am using Ibatis as a object mapper and Spring as the DAO. Ibatis
assures me that Ibatis is just passing the parameters strait to the
driver without modifying them. Ibatis is logging the Insert statement as:

DEBUG [http-8080-2] - {conn-100072} Preparing Statement: INSERT
INTO receiveorder (rcv_date, rcv_po_number, rcv_invoice_number,
rcv_vendor_code, rcv_vendor_name, rcv_str_fk, rcv_usr_fk,
rcv_time_changed) values (?, ?, ?, ?, ?, ?, ?, NOW())
DEBUG [http-8080-2] - {pstm-100073} Executing Statement: INSERT
INTO receiveorder (rcv_date, rcv_po_number, rcv_invoice_number,
rcv_vendor_code, rcv_vendor_name, rcv_str_fk, rcv_usr_fk,
rcv_time_changed) values (?, ?, ?, ?, ?, ?, ?, NOW())
DEBUG [http-8080-2] - {pstm-100073} Parameters: [2008-09-17
19:55:44.774, 333, 333, 93 , American Biologics , 1, 3]
DEBUG [http-8080-2] - {pstm-100073} Types: [java.sql.Timestamp,
java.lang.String, java.lang.String, java.lang.String, java.lang.String,
java.lang.Integer, java.lang.Integer]

rcv_date is the field that is causing the problem not the NOW()
function. When this statement in executed from the Apple machine the
timestamp in the db is 2008-09-17 19:55:44.774 and when it is executed
on the Windows machine the timestamp in the db is 2008-09-17 19:55:44.77
. On the Windows machine it looses the last decimal of the milliseconds
from miliseconds to hundreths. When the Windows machine does a SELECT on
the record with the milliseconds it gives me the following exception:

DEBUG [http-8080-1] - {pstm-100294} Executing Statement: SELECT
rcv_pk, rcv_str_fk, rcv_date, rcv_po_number, rcv_invoice_number,
rcv_vendor_code, rcv_vendor_name, rcv_processed, rcv_report, rcv_usr_fk
FROM receiveorder WHERE rcv_processed = ? ORDER BY rcv_date DESC
DEBUG [http-8080-1] - {pstm-100294} Parameters: [false]
DEBUG [http-8080-1] - {pstm-100294} Types: [java.lang.Boolean]


DEBUG [http-8080-1] - {rset-100295} Result: [3737, 1, 2008-09-18
02:35:36.8, 454 , 323 ,
329 , Garden Of Life , false, false, 3, 3737]
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient
operation; uncategorized SQLException for SQL []; SQL state [null];
error code [0];
--- The error occurred in
com/clarks/spanky/persistence/sqlmapdao/sql/postgres/recvOrder-postgres.xml.

--- The error occurred while applying a result map.
--- Check the RecvOrder.recvOrderWithLineItemsResult.
--- Check the result mapping for the 'recvOrderDate' property.
--- Cause: Bad Timestamp Format at 23 in 2008-09-17 19:49:03.327; nested
exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
com/clarks/spanky/persistence/sqlmapdao/sql/postgres/recvOrder-postgres.xml.

--- The error occurred while applying a result map.
--- Check the RecvOrder.recvOrderWithLineItemsResult.
--- Check the result mapping for the 'recvOrderDate' property.
--- Cause: Bad Timestamp Format at 23 in 2008-09-17 19:49:03.327
at
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:121)
at
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:212)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:249)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:296)
at
com.clarks.spanky.persistence.sqlmapdao.RecvOrderSqlMapDao.getProcessedRecvOrderListWithLineItems(RecvOrderSqlMapDao.java:49)
at
com.clarks.spanky.service.ReceivingService.getProcessedRecvOrderListWithLineItems(ReceivingService.java:82)
at
com.clarks.spanky.presentation.ReceivingBean.goToOpenedReceivings(ReceivingBean.java:238)
at
com.clarks.spanky.presentation.NavRecvBean.receivingNavigation(NavRecvBean.java:84)
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:597)
at com.clarks.struts.BeanAction.execute(BeanAction.java:123)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:856)
at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565)
at
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
com/clarks/spanky/persistence/sqlmapdao/sql/postgres/recvOrder-postgres.xml.

--- The error occurred while applying a result map.
--- Check the RecvOrder.recvOrderWithLineItemsResult.
--- Check the result mapping for the 'recvOrderDate' property.
--- Cause: Bad Timestamp Format at 23 in 2008-09-17 19:49:03.327
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at
org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:298)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:209)
... 29 more
Caused by: Bad Timestamp Format at 23 in 2008-09-17 19:49:03.327
at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java:517)
at org.postgresql.jdbc2.ResultSet.getTimestamp(ResultSet.java:675)
at
org.apache.commons.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:262)
at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)
at $Proxy4.getTimestamp(Unknown Source)
at
com.ibatis.sqlmap.engine.type.DateTypeHandler.getResult(DateTypeHandler.java:38)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResultMappingValue(BasicResultMap.java:611)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:344)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:381)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:190)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
... 35 more


Kris Jurka wrote:
>
>
> On Wed, 17 Sep 2008, Warren Bell wrote:
>
>> I have Postgresql 8.3 (PostgresPlus) running on an Apple with Tomcat
>> 6. I am using the postgresql-8.3-603.jdbc3.jar driver. My app runs
>> fine when on the apple, but when I move it over to a Windows machine
>> running Tomcat 6 that accesses the same exact database on the Apple I
>> get a "Bad Timestamp Format at 23 in 2008-09-16 18:41:00.479" error.
>
> This isn't an error that the JDBC driver produces. Can you provide a
> stacktrace to show where this error is actually generated?
>
> Kris Jurka


--
Thanks,

Warren Bell
909-645-8864
warren@clarksnutrition.com


--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

No comments: