code: public static int getGeometryType(Connection connection,TableLocation location, String fieldName)
              throws SQLException {
          if(fieldName==null || fieldName.isEmpty()) {
              List<String> geometryFields = getGeometryFields(connection, location);
              if(geometryFields.isEmpty()) {
                  throw new SQLException("The table "+location+" does not contain a Geometry field, " +
                          "then geometry type cannot be computed");
              }
              fieldName = geometryFields.get(0);
          }
          ResultSet geomResultSet = getGeometryColumnsView(connection,location.getCatalog(),location.getSchema(),
                  location.getTable());
          boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData());
          while(geomResultSet.next()) {
              if(fieldName.isEmpty() || geomResultSet.getString("F_GEOMETRY_COLUMN").equalsIgnoreCase(fieldName)) {
                  if(isH2) {
                      return geomResultSet.getInt("GEOMETRY_TYPE");
                  } else {
                      return GEOM_TYPE_TO_SFS_CODE.get(geomResultSet.getString("type").toLowerCase());
                  }
              }
          }
          throw new SQLException("Field not found "+fieldName);
      }
docs: Return the sfs geometry type identifier of the provided field of the provided table.
  
  @param connection Active connection
  @param location Catalog, schema and table name
  @param fieldName Geometry field name or empty (take the first one)
  
  @return The sfs geometry type identifier
  
  @see GeometryTypeCodes
  
  @throws SQLException