[postgis-users] Re: Buffering with JDBC

Obe, Regina robe.dnd at cityofboston.gov
Mon May 14 07:32:22 PDT 2007


Shotka,
 
Just noticed you are doing this
      Class.forName("org.postgresql.Driver");

      String url = "jdbc:postgresql://localhost:5432/database"; conn =
DriverManager.getConnection(url, "postgres", "");  

 
((org.postgresql.jdbc2.Jdbc2Connection)conn).addDataType("Geometry","org
..postgis.PGgeometry");
     ((org.postgresql.jdbc2.Jdbc2Connection)conn).addDataTy
pe("box3d","org.postgis.PGbox3d");

     Statement s = conn.createStatement();

 

and I'm used to seeing people do this

 

      Class.forName("org.postgresql.Driver");

      String url = "jdbc:postgresql://localhost:5432/database"; conn =
DriverManager.getConnection(url, "postgres", "");  

     ((org.postgresql.PGConnection)
conn).addDataType("geometry",org.postgis.PGgeometry.class);
     ((org.postgresql.PGConnection) conn).addDataTy
pe("box3d",org.postgis.PGbox3d.class);

     Statement s = conn.createStatement();

 

or this

     ((org.postgresql.Connection)
conn).addDataType("geometry",org.postgis.PGgeometry.class);
     ((org.postgresql.Connection) conn).addDataTy
pe("box3d",org.postgis.PGbox3d.class);

or this (with or without the PGConnection)

    ((org.postgresql.Connection)
conn).addDataType("geometry","org.postgis.PGgeometry");
     ((org.postgresql.Connection) conn).addDataTy
pe("box3d","org.postgis.PGbox3d");

I'm really not sure the difference between all of them except I assume
it depends on the postgresql driver version and maybe your approach is
newer or older.  Have you tried the other ways?

Also you have the geometry case for addType in upper case, where as it
is normally written in lower case.  I'm not sure what sorts of problems
that may or may not cause.

 

Also if you do something like

out.println(r.getObject(1).getClass().getName());

 

What do you get?

Hope that helps,

Regina


________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
shojka at web.de
Sent: Monday, May 14, 2007 6:14 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Re: Buffering with JDBC


Thank you for your answers. I have POSTGRESQL version 8.1. All proposed
changes did not work. As a result I get an exception caused by unknown
type (this should be geometry) regardless if I use buffer or any other
function. I would be very gateful if someone could give me more ideas
how to solve this problem. 


 <https://img.web.de/p.gif> 	
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!   
http://smartsurfer.web.de/?mc=100071&d istributionid=000000000066
<http://smartsurfer.web.de/?mc=100071&distributionid=000000000066>   	


-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070514/bd314324/attachment.html>


More information about the postgis-users mailing list