JDBC get object - (Geometry Postgis)

From: Pedro Salazar <pedro-b-salazar(at)ptinovacao(dot)pt>
To: postgres <pgsql-jdbc(at)postgresql(dot)org>
Subject: JDBC get object - (Geometry Postgis)
Date: 2003-04-08 15:09:55
Message-ID: 1049814594.14877.64.camel@vitoria.intra.cet.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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.
--
PS
pedro-b-salazar(at)ptinovacao(dot)pt
PGP:0E129E31D803BC61

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Pedro Salazar 2003-04-08 15:38:23 Re: JDBC get object - (Geometry Postgis)
Previous Message Dave Cramer 2003-04-08 15:04:24 Re: JDBC get object - (Geometry Postgis)