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

Paul Ramsey pramsey at refractions.net
Tue Apr 8 09:13:01 PDT 2003


Try doing the addDataType without the typecast first. It looks like the  
JDBC implementation changed between 7.2 and 7.3. If you read the source  
(Luke) you'll find that addDataType still exists, but it is now part of  
the AbstractJDBC1Connection object, so you might be able to call it  
directly on the connection.

P

On Tuesday, April 8, 2003, at 07:58 AM, Pedro Salazar wrote:

> 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.P 
> Ggeometry");
> ((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbo 
> x3d");
>
> 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
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
      Paul Ramsey
      Refractions Research
      Email: pramsey at refractions.net
      Phone: (250) 885-0632




More information about the postgis-users mailing list