Re: JDBC get object - (Geometry Postgis)

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: Pedro Salazar <pedro-b-salazar(at)ptinovacao(dot)pt>
Cc: postgres <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC get object - (Geometry Postgis)
Date: 2003-04-08 14:25:11
Message-ID: 1049811910.1743.58.camel@inspiron.cramers
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)micro-automation(dot)net>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2003-04-08 14:51:51 Re: JDBC get object - (Geometry Postgis)
Previous Message Davide Romanini 2003-04-06 18:01:45 Again about charset encoding and accents