[postgis] JDBC Problem

David Graham dgraham at i3.com
Mon Jan 7 08:47:14 PST 2002


It may be in initializing your connection (conn) variable.  By default 
the postgresql driver does not know what a PGgeometry is.

Did you include:

       /* 
        * Add the geometry types to the connection. Note that you 
        * must cast the connection to the pgsql-specific connection * implementation before calling the addDataType() method. 
        */
  		    ((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
  		    ((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");

after you got your connection?


mtondorf2002 wrote:

>I am trying to load PGgeometry objects from a Postgis table but I always get an exeption (java.lang.String) in line (PGgeometry pgeom = (PGgeometry)ors.getObject(1);)
>
>try {
>String query = "SELECT AsText(geometrie) as geometrie, ID_"+jTextField_tableName.getText()+" FROM "+ jTextField_tableName.getText();
>
>Statement stm = conn.createStatement();
>ResultSet ors = stm.executeQuery(query);
>while (ors.next()) {
>  PGgeometry pgeom = (PGgeometry)ors.getObject(1);
>  int aktID = ors.getInt(2);
>}
>stm.close();
>}
>catch (Exception de) {
>jTextArea_Error.setText(de.getMessage());
>jLabel_Status.setText("Konnte Daten nicht auslesen.");
>}
>
>Where is my mistake?
>
>Markus Tondorf
>
>
>
>To unsubscribe from this group, send an email to:
>postgis-unsubscribe at yahoogroups.com
>
> 
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
>
>
>
>




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Tiny Wireless Camera under $80!
Order Now! FREE VCR Commander!
Click Here - Only 1 Day Left!
http://us.click.yahoo.com/WoOlbB/7.PDAA/ySSFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 





More information about the postgis-users mailing list