Skip site navigation (1) Skip section navigation (2)

RE: Postgres JDBC driver : problem with timestamps.

From: Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
To: "'Vincent Trussart'" <trussarv(at)CIRANO(dot)UMontreal(dot)CA>, Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>, pgsql-interfaces(at)postgresql(dot)org
Subject: RE: Postgres JDBC driver : problem with timestamps.
Date: 2000-06-26 08:02:43
Message-ID: (view raw or whole thread)
Lists: pgsql-interfaces
This was fixed a couple of weeks ago...

Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council

-----Original Message-----
From: Vincent Trussart [mailto:trussarv(at)CIRANO(dot)UMontreal(dot)CA]
Sent: Wednesday, June 14, 2000 7:42 PM
To: petermount(at)it(dot)maidstone(dot)gov(dot)uk; pgsql-interfaces(at)postgresql(dot)org
Subject: [INTERFACES] Postgres JDBC driver : problem with timestamps.

Using the JDBC drivers (for 1.2) from the postgresql-7.0.2 rpm
I cannot read back a timestamp value I just inserted in a column (column
type "timestamp")
with the same application.  This little java code fails :

import java.sql.*;

public class test {

    public static void main(String[] args) throws Exception {

        Connection conn =
DriverManager.getConnection("jdbc:postgresql://localhost/test", "test",
        PreparedStatement stmt = conn.prepareStatement("insert into test
values (?)");
        stmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));


        Statement reader = conn.createStatement();
        ResultSet rs = reader.executeQuery("select * from test");
        while ({

Running this code gives :

Exception in thread "main" Bad Timestamp Format at 19 in 2000-06-14
 at org.postgresql.jdbc2.ResultSet.getTimestamp(
 at test.main(

Any idea?

Vincent Trussart

pgsql-interfaces by date

Next:From: Marcus AldayDate: 2000-06-26 09:22:47
Subject: Need help getting JDBC setup.
Previous:From: Peter MountDate: 2000-06-26 07:46:21
Subject: RE: getMoreResults() returns false incorrectly

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group