2 Replies Latest reply: May 26, 2012 6:29 PM by rp0428 RSS

    How to get the contents of a spatiallite sqlitejdbc field?

    939929
      Hi
      I have this code:

      ...
      statement.executeUpdate("SELECT AddGeometryColumn('areas', 'geom', 4326, 'POLYGON', 'XY')");

      //Basic square
      String strSt="INSERT INTO areas VALUES (1, 'zoneA', GeomFromText('POLYGON (0 0, 10 0, 10 10, 0 10)',4326))";
      statement.executeUpdate(strSt);



      strSt="select geom from areas where areas.label == 'zoneA'";
      ResultSet rs=statement.executeQuery(strSt);
      if(rs.next())
      {
      str=rs.getString("geom");



      and it says that geom field does not exists.


      Then I:

      ResultSetMetaData rsmd = rs.getMetaData();
      int numColumns = rsmd.getColumnCount();

      // Get the column names; column indices start from 1
      for (int i=1; i<numColumns+1; i++)
      {
      String columnName = rsmd.getColumnName(i);
      String str= rsmd.getColumnTypeName(i);
      int d= rsmd.getColumnType(i);
      str2=rsmd.getColumnClassName(i);

      columnName has 'geom'
      str has null
      d has 0
      str2 has java.lang.Object


      So how to get the value of that field?


      Thanks a lot

      Alex