The following bug has been logged online:

Bug reference:      1073
Logged by:          Bob Messenger

Email address:      [EMAIL PROTECTED]

PostgreSQL version: 7.5 Dev

Operating system:   Linux

Description:        JDBC "time with time zone"

Details: 

create table a(b time with time zone);

insert into a values ('00:00:00');

import java.sql.*;

public class JDBC
{
    public JDBC()
        throws Exception
    {
        Class.forName("org.postgresql.Driver");
        DriverManager.setLogStream(System.out);
        Connection db = 
DriverManager.getConnection("jdbc:postgresql://blah/blah?loglevel=3", 
"postgres", null); 

        Statement st = db.createStatement();
        ResultSet rs = st.executeQuery("SELECT b FROM a");
        while (rs.next())
        {
            System.out.println(rs.getString(1));
            System.out.println(rs.getTimestamp(1));
        }
        rs.close();
        st.close();
        db.close();
    }

    public final static void main(String args[])
        throws Exception
    {
        new JDBC();
    }
}

getConnection returning 
driver[className=org.postgresql.Driver,[EMAIL PROTECTED] 
00:00:00+00
Exception in thread "main" org.postgresql.util.PSQLException: Bad Timestamp 
Format at 2 in 00:00:00+00 
org.postgresql.jdbc1.AbstractJdbc1ResultSet.toTimestamp(AbstractJdbc1Result
        at Set.java:1183) 
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getTimestamp(AbstractJdbc1Resul
        at tSet.java:376) 
        at JDBC.<init>(JDBC.java:17)
        at JDBC.main(JDBC.java:27)



---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to