Re: Bad Value for Data Type Timestamp

Поиск
Список
Период
Сортировка
От Jonathan Vallar
Тема Re: Bad Value for Data Type Timestamp
Дата
Msg-id 6c1017c20602281854w21b6f2c6h9b6bda9673db0421@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Bad Value for Data Type Timestamp  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-jdbc
Hi!

I think the data I sent was mistakenly added a space betwwen the seconds and the minutes. I am not sure though becauseI dont have the actual at the database anymore. I tried inserting another set of records and below is the sample data:

wbi_db=> select * from xworlds_events limit 2;;
 event_id | connector_id | object_key |     object_name      | object_verb | event_priority |         event_time         | event_status | event_comment
----------+--------------+------------+----------------------+-------------+----------------+----------------------------+--------------+---------------
        1 | PostgreSQL   | 8100000000 | POS_to_SAP_1_WRAPPER | Create      |              1 | 2006-03-01 09:47:04.018543 |            0 | Test
        1 | PostgreSQL   | 8100000000 | POS_to_SAP_1_WRAPPER | Create      |              1 | 2006-03-01 10:12: 54.800429 |            0 | Test
(2 rows)

Also here is my sample insert statement:

insert into xworlds_events (event_id, connector_id, object_key, object_name, object_verb, event_priority, event_time,event_status,event_comment) values (1,'PostgreSQL',8100000000,'POS_to_SAP_1_WRAPPER','Create',1,now(),0,'Test');

I tried to create a java program that gets data from the postgres. It worked fine. I used the Timestamp methods in getting data from the field with the timestamp data type.  Attached is my sample java code.

I have a question. With regards to the error on the timestamp I mentioned, the error happened at (org.postgresql.jdbc2.TimestampUtils.loadCalendar(TimestampUtils.java:151). This means that the last function called was the loadCalendar function. Where the error occured. (Is my assumption right?). If this is the case, then the data was still being obtained by the postgres driver?

Here is the error stack trace:

Retrieve Operation failed on the BusinessObject Bad value for type =
timestamp : [C@56c55d28  Exception: java.lang.NumberFormatException: =
Expected time to be colon-separated, got ' Stack Trace:  =
java.lang.NumberFormatException: Expected time to be colon-separated, =
got '  at =
org.postgresql.jdbc2.TimestampUtils.loadCalendar(TimestampUtils.java:151)=
   at =
org.postgresql.jdbc2.TimestampUtils.toTimestamp (TimestampUtils.java:307) =
  at =
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2Res=
ultSet.java:419)   at =
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getTimestamp(AbstractJdbc2Res=
ultSet.java:2088)   at =
com.crossworlds.connectors.JDBC.JDBCBOhandler.doContainerRetrieve(JDBCBOh=
andler.java:3697)   at =
com.crossworlds.connectors.JDBC.JDBCBOhandler.doRecursiveRetrieve(JDBCBOh=
andler.java :3316)   at =
com.crossworlds.connectors.JDBC.JDBCBOhandler.doRetrieve(JDBCBOhandler.ja=
va:3265)   at =
com.crossworlds.connectors.JDBC.JDBCBOhandler.doVerbFor(JDBCBOhandler.jav=
a:1346)   at =
com.crossworlds.cwconnectorapi.CWConnectorBOHandler.doVerbFor (CWConnector=
BOHandler.java:127)   at =
CxCommon.BusinessObject.doVerbFor(BusinessObject.java:2128)   at =
com.crossworlds.cwconnectorapi.CWConnectorBusObj.doVerbFor(CWConnectorBus=
Obj.java:126)   at =
com.crossworlds.connectors.JDBC.JDBCConnectorAgent.pollForEvents (JDBCConn=
ectorAgent.java:1137)   at =
AppSide_Connector.BusObjJavaInterface.poll(BusObjJavaInterface.java:355) =
  at AppSide_Connector.AppCalls.poll(AppCalls.java:191)   at =
AppSide_Connector.AgentBusinessObjectManager.poll(AgentBusinessObjectMana=
ger.java:719)   at =
AppSide_Connector.AppPolling.poll(AppPolling.java:294)   at =
AppSide_Connector.AppPolling.doPollingContinuousWait(AppPolling.java:556)=
   at AppSide_Connector.AppPolling.run(AppPolling.java :121)   at =
java.lang.Thread.run(Thread.java:513)  End of Stack Trace   SQLException =
{2}]

Thanks in advance!

Regards,

Jonathan


On 3/1/06, Tom Lane < tgl@sss.pgh.pa.us> wrote:
Dave Cramer < pg@fastcrypt.com > writes:
> Internally timestamps are stored as seconds. Is there an output
> format that formats with a space between seconds and minutes ?

No, and after taking a quick look at the formatting code (EncodeDateTime())
it would take a very seriously broken printf() implementation to cause
that to happen ...

                        regards, tom lane

Вложения

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bad Value for Data Type Timestamp
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: Bad Value for Data Type Timestamp