pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedjdbc integer value oid to big!
3+ messages / 3 participants
[nested] [flat]
* jdbc integer value oid to big!
@ 2007-03-05 15:44 Danny Schueler <danny.schueler@bvv.bayern.de>
0 siblings, 1 reply; 3+ messages in thread
From: Danny Schueler @ 2007-03-05 15:44 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: jdbc integer value oid to big!
@ 2007-03-05 16:38 Heikki Linnakangas <heikki@enterprisedb.com>
parent: Danny Schueler <danny.schueler@bvv.bayern.de>
0 siblings, 1 reply; 3+ messages in thread
From: Heikki Linnakangas @ 2007-03-05 16:38 UTC (permalink / raw)
To: Danny Schueler <danny.schueler@bvv.bayern.de>; +Cc: pgsql-jdbc
Danny Schueler wrote:
> 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?
That was fixed in CVS head few weeks ago. If you need the fix
immediately, you can checkout the latest CVS version and build the
driver yourself.
I think we should backpatch the fix...
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: jdbc integer value oid to big!
@ 2007-03-05 17:19 Kris Jurka <books@ejurka.com>
parent: Heikki Linnakangas <heikki@enterprisedb.com>
0 siblings, 0 replies; 3+ messages in thread
From: Kris Jurka @ 2007-03-05 17:19 UTC (permalink / raw)
To: Heikki Linnakangas <heikki@enterprisedb.com>; +Cc: Danny Schueler <danny.schueler@bvv.bayern.de>; pgsql-jdbc
On Mon, 5 Mar 2007, Heikki Linnakangas wrote:
> I think we should backpatch the fix...
>
I was hesitant to backpatch this particular fix because I was concerned
about breaking existing code. I don't think we can change the default
return type for oid from Integer to Long in a minor release.
Kris Jurka
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2007-03-05 17:19 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-03-05 15:44 jdbc integer value oid to big! Danny Schueler <danny.schueler@bvv.bayern.de>
2007-03-05 16:38 ` Heikki Linnakangas <heikki@enterprisedb.com>
2007-03-05 17:19 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox