Thread: TimeStamp problem...

TimeStamp problem...

From
"Vitali Petrov"
Date:
Then I insert new values with timestamp into table I get an error:
Can anyone tell why?

Code:
PreparedStatement newPStat ...
newPStat.setTimestamp(1, Timestamp.valueOf("2003-01-21 12:25:14"));
newPStat.executeUpdate();

Error:
java.sql.SQLException: ERROR:  pg_atoi: error in "2003-01-21
12:25:14.000000+02": can't parse "-01-21 12:25:14.000000+02"


    at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131)

    at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)

    at
org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)

    at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)

    at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:197)

    at
rendifirma.RendiaktidTableModel.insertNewRow(RendiaktidTableModel.java:131)

Thanks.

_________________________________________________________________
MSN 8: advanced junk mail protection and 2 months FREE*.
http://join.msn.com/?page=features/junkmail


Re: TimeStamp problem...

From
Tom Lane
Date:
"Vitali Petrov" <vitalipetrov@hotmail.com> writes:
> Then I insert new values with timestamp into table I get an error:
> Can anyone tell why?

> Code:
> PreparedStatement newPStat ...
> newPStat.setTimestamp(1, Timestamp.valueOf("2003-01-21 12:25:14"));
> newPStat.executeUpdate();

> Error:
> java.sql.SQLException: ERROR:  pg_atoi: error in "2003-01-21
> 12:25:14.000000+02": can't parse "-01-21 12:25:14.000000+02"

Since the complaint is coming from pg_atoi, it would seem that this
string is being fed to an integer column, not a timestamp column at
all.  Check your SQL...

            regards, tom lane

Re: TimeStamp problem...

From
"Vitali Petrov"
Date:
That's true!
Thank you!

>From: Tom Lane <tgl@sss.pgh.pa.us>
>To: "Vitali Petrov" <vitalipetrov@hotmail.com>
>CC: pgsql-jdbc@postgresql.org
>Subject: Re: [JDBC] TimeStamp problem... Date: Tue, 21 Jan 2003 09:59:35
>-0500
>
>"Vitali Petrov" <vitalipetrov@hotmail.com> writes:
> > Then I insert new values with timestamp into table I get an error:
> > Can anyone tell why?
>
> > Code:
> > PreparedStatement newPStat ...
> > newPStat.setTimestamp(1, Timestamp.valueOf("2003-01-21 12:25:14"));
> > newPStat.executeUpdate();
>
> > Error:
> > java.sql.SQLException: ERROR:  pg_atoi: error in "2003-01-21
> > 12:25:14.000000+02": can't parse "-01-21 12:25:14.000000+02"
>
>Since the complaint is coming from pg_atoi, it would seem that this
>string is being fed to an integer column, not a timestamp column at
>all.  Check your SQL...
>
>            regards, tom lane


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus