title: How to store geometry Point in Postgis database using java
body: <p>I'm trying to store a geometry object into my postgist database, which has a table with a geometry column. I got the geometry value from another table with a geometry column, and I print the value I got previously and it's ok. To store geometry value I use next function:</p>
  
  <pre><code>static void insertaGeometria( Geometry geom, int idInstalacion) throws ClassNotFoundException, SQLException{
  
          Connection congeom = conectarPGA();
  
          String geomsql ="INSERT INTO georrepositorio.geometria(id, point) VALUES (?,?)";
          PreparedStatement psSE= congeom.prepareStatement(geomsql);
          psSE.setInt(1, idInstalacion);
          psSE.setObject(2, geom);    
  
          psSE.execute();
          psSE.close();   
          congeom.close();    
      }
  </code></pre>
  
  <p>But I always get this error:</p>
  
  <blockquote>
    <p>org.postgresql.util.PSQLException: Can't infer the SQL type to use for
    an instance of org.postgis.Point. Use setObject() with an explicit
    Types value to specify the type to use.</p>
  </blockquote>
  
  <p>Do anyone know how to store it? ='(</p>
  
  <p>Thanks in advance!</p>