jdbc integer value oid to big! - Mailing list pgsql-jdbc
From | Danny Schueler |
---|---|
Subject | jdbc integer value oid to big! |
Date | |
Msg-id | 200703051644.26759.danny.schueler@bvv.bayern.de Whole thread Raw |
Responses |
Re: jdbc integer value oid to big!
|
List | pgsql-jdbc |
I try to use WFS-Tools like deegree or geoserver. Both are based on the jdbc-psql driver, to connect to a postgis-database. org.postgresql.util.PSQLException: Bad value for type int int : 3364667332. at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2630) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:1968) at org.postgresql.jdbc2.TypeInfoCache.getPGType(TypeInfoCache.java:161) at org.postgresql.jdbc2.AbstractJdbc2Connection.getPGType(AbstractJdbc2Connection.java:974) at org.postgresql.jdbc2.AbstractJdbc2Statement.setPGobject(AbstractJdbc2Statement.java:1539) at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1678) at org.postgresql.jdbc3.AbstractJdbc3Statement.setObject(AbstractJdbc3Statement.java:1438) at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1689) at org.deegree.io.datastore.sql.AbstractSQLDatastore.prepareStatement(Unknown Source) at org.deegree.io.datastore.sql.QueryHandler.performContentQuery(Unknown Source) at org.deegree.io.datastore.sql.QueryHandler.performQuery(Unknown Source) at org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(Unknown Source) at org.deegree.io.datastore.sql.AbstractSQLDatastore.performQuery(Unknown Source) at org.deegree.io.datastore.schema.MappedFeatureType.performQuery(Unknown Source) at org.deegree.ogcwebservices.wfs.GetFeatureHandler$Performer.run(Unknown Source) jdbc tries to connect to my huge database, where millions of geographic datasets are stored. In the next step, the software tries to detect the java-type of the values. For this issue, it is necessary, the determine the databases-oid of the dataset or the oid of the row. both are above 2,1 billion (above 2^31) in my postgres-db! It seems, that the jdbc-function "AbstractJdbc2ResultSet.toInt" can't handle those values and throws this error, when it tries to parse the string to integer (the Type for this value was returned from the TypeInfoCache) for Example : Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql://foo:/bar"; AbstractJdbc2Connection conn = (AbstractJdbc2Connection)DriverManager.getConnection(url, "postgres" , ""); TypeInfoCache tic = new TypeInfoCache(conn); Statement st = conn.createStatement(AbstractJdbc2ResultSet.TYPE_FORWARD_ONLY,AbstractJdbc2ResultSet.CONCUR_READ_ONLY); AbstractJdbc2ResultSet rs=(AbstractJdbc2ResultSet)st.executeQuery("select oid,obnr,poly from table limit 1;"); while (rs.next()) { if (tic.getJavaClass(rs.getColumnOID(1)).equals("java.lang.Integer")) { int value = rs.getInt(1); } } in short: The software detects the db-oids, determies the type of the values with the TypeInfoCache and gets Integer. The following attemt, to get the variable in it's original type, fails and results in an error! The database can handle integer values with max. values until 2^32 as oid (unsigned), the jdbc can handle only 2^31 (signed). What can i do, to fix this Problem? -- Mit freundlichen Grüßen Danny Schüler Sachgebiet 423 Bereitstellung von Fachdaten Landesamt für Vermessung und Geoinformation Alexandrastraße 4, 80538 München Tel: 089 2129-2958 Fax: 089 2129-22958 Mail: danny.schueler@bvv.bayern.de
pgsql-jdbc by date: