[postgis-users] adding a geometry to a Postgis db

Malm Paul paul.malm at saabgroup.com
Mon Apr 20 23:03:42 PDT 2009


 Hi list,
I have a geometry (com.vividsolutions.jts.geom.Geometry) which I would like to add as a geometry to the geometry colunm see below.
how can I do this in java (I don´t know so much of databases)? 

  PreparedStatement pstmt = null;
  String query = "insert into submap(submapid, mapid, blob, the_geom) values(?, ?, ?, ?)";
  pstmt = postGISdb.dbConnection.prepareStatement(query);
  pstmt.setInt(1, submapid);
  pstmt.setInt(2, mapId);
  pstmt.setBinaryStream(3, blob.getInputStream(), blob.toByteArray().length);

  //vividsolution geometry
  Geometry geo = submaps.get(submapNo).getSubmapsExtent();
  pstmt.set?????(4, ????);
  int rowCount = pstmt.executeUpdate();


/kind regards,
 Paul



More information about the postgis-users mailing list