bug?: java won't read timestamps 
Author Message
 bug?: java won't read timestamps

Hi there,

I have a table containing "timestamp with time zone" and I observed
a strange problem:

THE ENVIRONMENT:
        Linux 2.4.0
        Postgres 7.1.2
        JDK 1.3.1 (same with JDK 1.3.0)
        postgresql.jar from $PGHOME/share/java

THE TABLE:
                            Table "hits"
          Attribute   |           Type           | Modifier
        --------------+--------------------------+----------
         id           | integer                  |
         zeit         | timestamp with time zone |

THE PROGRAM:

        stmt = toDB.createStatement();
        ResultSet rs = stmt.executeQuery( "SELECT max(zeit) FROM hits" );
        rs.next();
        ts = rs.getTimestamp(1); // <-- breaks here
        stmt.close();

THE ERROR:

        Bad Timestamp Format at 19 in 2001-03-05 17:17:13.24+01

The second fraction seems not to be supported by the jdbc timestamp
reader. BTW: there is no format specifier for them as well (at least
in the docs).

I am helping myself by forcing a different output
        to_char(max(zeit),"YYYY-MM-DD HH24:MI:SS+01")
Is there a better solution?

(Is the relevant code in java.sql or is it in org.postgresql?)

With kind regards / Mit freundlichem Gru?
    Holger Klawitter
--
Holger Klawitter

---------------------------(end of broadcast)---------------------------



Mon, 24 Nov 2003 01:02:26 GMT
 bug?: java won't read timestamps

Hi Dave,

Thanks for your hint. It was indeed a problem with an older postgresql.jar
sneaking into my classpath.

With kind regards / Mit freundlichem Gru?
    Holger Klawitter
--
Holger Klawitter

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Mon, 24 Nov 2003 16:15:47 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. bug?: java won't read timestamps

2. BUG: Access 97 stored Query won't read through ODBC

3. 'current' timestamp bug

4. Laptop CDROM won't let P45 read it's files

5. TimeStamp won't work for me!

6. BUG?: timestamp without TZ created as timestamp *with*

7. BUG?: timestamp without TZ created as timestamp

8. BUG?: timestamp without TZ created as timestamp *with* TZ

9. UDB 5.2 JDBC timestamp format different from java.sql.timestamp

10. HELP: Wildcard won't work in WHERE (or THE WIERDEST BUG EVER)

11. Paradox [4.5,5.0][WIN] - Memory bug sol'n

12. bug: str() won't work on decimal(12,0)


 
Powered by phpBB® Forum Software