[postgis-users] JDBC retrieve geometry object: how to?

Pedro Salazar pedro-b-salazar at ptinovacao.pt
Tue Apr 8 07:58:42 PDT 2003


Greetings,

I'm trying to get a geometry from the database through JDBC. I read the
documentation but I think it's not actualized - there isn't any
org.postgresql.Connection object but a org.postgresql.PGConnection that
hasn't any such method as adddataType().

Example from POSGIS documentation:
---
...
((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
  
Statement s = conn.createStatement(); 
ResultSet r = s.executeQuery("select AsText(geom) as geom,id from geomtable"); 
while( r.next() ) { 
	PGgeometry geom = (PGgeometry)r.getObject(1); 
	...
---

How could I retrieve a geometry from a postgresql (7.3.2) database with
postgis 0.7.4?

thanks,
Pedro Salazar.

-- 
PS
pedro-b-salazar at ptinovacao.pt
PGP:0E129E31D803BC61




More information about the postgis-users mailing list