JDBC-Driver produces wrong output.

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема JDBC-Driver produces wrong output.
Дата
Msg-id 200011020934.eA29Y8b72201@hub.org
обсуждение исходный текст
Список pgsql-bugs
Jan Thomae (jan@smb-tec.com) 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
withit 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
followingdate into each of the columns: 15.10.1978 20:47:56 CET. After this I ran a small test program (see the
attachedsource 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
PostgreSQLand 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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Joins on over 10 tables returns unreliable results
Следующее
От: Jan Thomae
Дата:
Сообщение: My Bug report: JDBC-Driver produces wrong output.