Jan Thomae ([EMAIL PROTECTED]) reports a bug with a severity of 2
The lower the number the more severe it is.
Short Description
JDBC-Driver produces wrong output.
Long Description
Hi,
I recently downloaded the last snapshot of PostgreSQL and also the newest JDBC-Driver
for it. I played a bit around with it and it seems to produce some really weird output
on datetimes and timestamps. I added a table "test" into the database, containing two
columns "test1" and "test2". "test1" is a timestamp, "test2" a datetime. Then I
entered the following date into each of the columns: 15.10.1978 20:47:56 CET. After
this I ran a small test program (see the attached source code). This produced the
following output:
|1981-11-15 20:00:56.0|1981-11-15 20:00:56.0
As you can see, the dates are different from what I entered into the database. This
error did not occur using the 6.4 PostgreSQL and belonging driver. Do I do something
wrong ?
Sample Code
Hashtable defaultProperties = new Hashtable();
defaultProperties.put(JDBCResource.HOSTNAME, "frodo");
defaultProperties.put(JDBCResource.PORT, "5432");
defaultProperties.put(JDBCResource.USERNAME, "jan");
defaultProperties.put(JDBCResource.PASSWORD, "");
defaultProperties.put(JDBCResource.DATABASE, "testdb");
Class.forName("org.postgresql.Driver");
Connection connection = DriverManager.getConnection(...)
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM test");
while (rs.next()) {
int cols = rs.getMetaData().getColumnCount();
for (int i=1; i<=cols; i++) {
System.out.print("|" + rs.getObject(i));
}
System.out.println("");
}
rs.close();
No file was uploaded with this report