Postgresql8.4 + floats with jdbc driver postgresql-8.4-701.jdbc4.jar
От | Hervé Hénoch |
---|---|
Тема | Postgresql8.4 + floats with jdbc driver postgresql-8.4-701.jdbc4.jar |
Дата | |
Msg-id | 4BD599A6.9080504@isc84.org обсуждение исходный текст |
Список | pgsql-jdbc |
Hello, We have a strange behavior when running this code : public static void main(String[] args) { try { Class.forName("org.postgresql.Driver"); Properties props = new Properties(); props.setProperty("user", "postgres"); props.setProperty("password", "mypassword"); Connection _connexion = DriverManager.getConnection( "jdbc:postgresql://<ip>:5432/personnel", props); _connexion .prepareStatement( "create temporary table test_oliv (val real);insert into test_oliv(val) values (1.8);" + "insert into test_oliv(val) values (1.8);insert into test_oliv(val) values (1.8);") .execute(); ResultSet rs = _connexion.prepareStatement( "select sum(val) as t from test_oliv;").executeQuery(); rs.next(); System.out.println("Float: " + rs.getFloat("t")); System.out.println("Double: " + rs.getDouble("t")); System.out.println("Object: " + rs.getObject("t")); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } The results are : Float: 5.3999996 Double: 5.3999996 Object: 5.3999996 With 8.2 driver the results are rights. Idea ? Regards
В списке pgsql-jdbc по дате отправления: