[postgis-users] JDBC retrieve geometry object: how to?
Pedro Salazar
pedro-b-salazar at ptinovacao.pt
Tue Apr 8 09:42:03 PDT 2003
Hi Paul,
shouldn't the addDataType be also in the PGConnection interface? (For
now I will cast it to AbstractJDBC1Connection instead of the
PGConnection)
BTW, if I intend to return my geometry object from a postgresql
function, what type should declare in my function to wrap my postgis
object, and what type my function would return?
thanks,
Pedro Salazar.
On Tue, 2003-04-08 at 17:13, Paul Ramsey wrote:
> 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
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
--
PS
pedro-b-salazar at ptinovacao.pt
PGP:0E129E31D803BC61
More information about the postgis-users
mailing list