Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry for my english, I hope you can understand ;) I'am using geotools 8.4 version. I try to copy all features from SDE Table(TEST.DBO.MM_SOURCE) to another SDE Table(TEST.DBO.MM_TEST). All features are copied correctly, but they are not stored in main table (TEST.DBO.MM_TEST). When I open ArcMap, edit some feature in TEST.DBO.MM_TEST and save, all features are back in main table. Both SDE tables are registered as versioned and moving edits to base. What I must do to store all features in main table?

Here is my java code:

String server = "localhost";
String port = "5151";
String database = "Test";
String user = "sa";
String password = "sa";
String version = "dbo.Default";

connector = new SDEConnector();
connector.setConnectionParameters(server, port, database, user, password, version);

SimpleFeatureStore dataStore =
        (SimpleFeatureStore) connector.getDataStore().getFeatureSource("TEST.DBO.MM_TEST");

SimpleFeatureCollection fc1 = connector.getFeatureCollection("TEST.DBO.MM_SOURCE")
SimpleFeatureCollection fc2 = dataStore.getFeatures();

SimpleFeatureIterator iterator = fc1.features();
while (iterator.hasNext()) {
    SimpleFeature feature =;
    Geometry geometry = (Geometry) feature.getDefaultGeometry();

    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(fc2.getSchema());
    builder.set("Shape", geometry);
    builder.set("P1", feature.getAttribute("P1"));
    builder.set("P2", feature.getAttribute("P2"));
    builder.set("Source_OID", 829023);
    builder.set("Marker", 10);

    SimpleFeature sf = builder.buildFeature(null);
    // SimpleFeature sf = builder.buildFeature(builder.createDefaultFeatureId());

    List<SimpleFeature> list = new ArrayList<SimpleFeature>();

time = System.currentTimeMillis() - time;
share|improve this question

You need to commit the changes to the datastore. You'll need some code like:

 if (featureSource instanceof SimpleFeatureStore) {
        SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;

        try {

        } catch (Exception problem) {

        } finally {
        System.exit(0); // success!
    } else {
        System.out.println(typeName + " does not support read/write access");

See this tutorial for more details.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.