Re: JDBC get object - (Geometry Postgis) - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: JDBC get object - (Geometry Postgis)
Date
Msg-id 1049811910.1743.58.camel@inspiron.cramers
Whole thread Raw
In response to JDBC get object - (Geometry Postgis)  (Pedro Salazar <pedro-b-salazar@ptinovacao.pt>)
Responses Re: JDBC get object - (Geometry Postgis)
List pgsql-jdbc
Pedro,

The geometry types are in the driver as

org.postgresql.geometric.PGcircle,PGline ....

Dave
On Tue, 2003-04-08 at 11:09, Pedro Salazar wrote:
> Greetings,
>
> I'm trying to get a geometry (object) from the database through JDBC. I
> read the postgis 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 object from a postgresql (7.3.2)
> database with postgis 0.7.4? How do I make a mapping or something like
> that? I believe that AsText() delivers a text and not an object...
>
> thanks,
> Pedro Salazar.
>
> P.S.- If this email is too much postgis than postgresql, I apologize for
> the off-topic message.
--
Dave Cramer <Dave@micro-automation.net>


pgsql-jdbc by date:

Previous
From: Pedro Salazar
Date:
Subject: JDBC get object - (Geometry Postgis)
Next
From: Pedro Salazar
Date:
Subject: Re: JDBC get object - (Geometry Postgis)