Example usage for java.sql ResultSet CONCUR_READ_ONLY

List of usage examples for java.sql ResultSet CONCUR_READ_ONLY

Introduction

In this page you can find the example usage for java.sql ResultSet CONCUR_READ_ONLY.

Prototype

int CONCUR_READ_ONLY

To view the source code for java.sql ResultSet CONCUR_READ_ONLY.

Click Source Link

Document

The constant indicating the concurrency mode for a ResultSet object that may NOT be updated.

Usage

From source file:com.github.adejanovski.cassandra.jdbc.CassandraStatement.java

public int getResultSetConcurrency() throws SQLException {
    checkNotClosed();
    return ResultSet.CONCUR_READ_ONLY;
}

From source file:com.frostwire.database.sqlite.SQLiteDatabase.java

private PreparedStatement prepareStatement(Connection connection, String sql, Object... arguments)
        throws Exception {

    PreparedStatement statement = connection.prepareStatement(sql, ResultSet.TYPE_SCROLL_SENSITIVE,
            ResultSet.CONCUR_READ_ONLY);

    if (arguments != null) {
        for (int i = 0; i < arguments.length; i++) {
            statement.setObject(i + 1, arguments[i]);
        }/*from w w w.j av  a 2s  .co  m*/
    }
    return statement;
}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AttachmentTable.java

public MSSBamAttachmentBuff[] readBuffByContactIdx(MSSBamAuthorization Authorization, long ContactId) {
    final String S_ProcName = "readBuffByContactIdx";
    try {//from   w w  w.j a  v  a  2s .co m
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectAttachmentBuff + "WHERE " + "attc.ContactId = " + Long.toString(ContactId) + " "
                + "ORDER BY " + "attc.AttachmentId ASC";
        Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        ResultSet resultSet = stmt.executeQuery(sql);
        List<MSSBamAttachmentBuff> buffList = new ArrayList<MSSBamAttachmentBuff>();
        while (resultSet.next()) {
            MSSBamAttachmentBuff buff = unpackAttachmentResultSetToBuff(resultSet);
            buffList.add(buff);
        }
        return (buffList.toArray(new MSSBamAttachmentBuff[0]));
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    }
}

From source file:com.cloudera.sqoop.manager.OracleManagerTest.java

public void testPurgeClosedConnections() throws Exception {
    // Ensure that after an Oracle ConnManager releases any connections
    // back into the cache (or closes them as redundant), it does not
    // attempt to re-use the closed connection.

    SqoopOptions options = new SqoopOptions(OracleUtils.CONNECT_STRING, TABLE_NAME);
    OracleUtils.setOracleAuth(options);//from w ww .j  a  v  a 2  s .com

    // Create a connection manager, use it, and then recycle its connection
    // into the cache.
    ConnManager m1 = new OracleManager(options);
    Connection c1 = m1.getConnection();
    PreparedStatement s = c1.prepareStatement("SELECT 1 FROM dual", ResultSet.TYPE_FORWARD_ONLY,
            ResultSet.CONCUR_READ_ONLY);
    ResultSet rs = null;
    try {
        rs = s.executeQuery();
        rs.close();
    } finally {
        s.close();
    }

    ConnManager m2 = new OracleManager(options);
    Connection c2 = m2.getConnection(); // get a new connection.

    m1.close(); // c1 should now be cached.

    // Use the second connection to run a statement.
    s = c2.prepareStatement("SELECT 2 FROM dual", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    try {
        rs = s.executeQuery();
        rs.close();
    } finally {
        s.close();
    }

    m2.close(); // c2 should be discarded (c1 is already cached).

    // Try to get another connection from m2. This should result in
    // a completely different connection getting served back to us.
    Connection c2a = m2.getConnection();

    assertFalse(c1.isClosed());
    assertTrue(c2.isClosed());
    assertFalse(c2a.isClosed());

    s = c2a.prepareStatement("SELECT 3 FROM dual", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    try {
        rs = s.executeQuery();
        rs.close();
    } finally {
        s.close();
    }

    m2.close(); // Close the manager's active connection again.
}

From source file:com.micromux.cassandra.jdbc.JdbcRegressionTest.java

/**
 * Test a simple resultset. This technically also demonstrates the upsert functionality
 * of Cassandra./*from  w w  w .j  a  v a2 s .  c  o m*/
 */
@Test
public void testSimpleResultSet() throws Exception {
    Statement stmt = con.createStatement();

    // Create the target Column family
    String createCF = "CREATE COLUMNFAMILY t59 (k int PRIMARY KEY," + "c text " + ") ;";

    stmt.execute(createCF);
    stmt.close();
    con.close();

    // open it up again to see the new CF
    con = DriverManager
            .getConnection(String.format("jdbc:cassandra://%s:%d/%s?%s", HOST, PORT, KEYSPACE, OPTIONS));

    PreparedStatement statement = con.prepareStatement("update t59 set c=? where k=123",
            ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    statement.setString(1, "hello");
    statement.executeUpdate();

    ResultSet result = statement.executeQuery("SELECT * FROM t59;");

    System.out.println(resultToDisplay(result, 59, null));

}

From source file:br.org.indt.ndg.server.client.TemporaryOpenRosaBussinessDelegate.java

public String getFormattedSurvey(String formId, String imei) {
    String result = null;/*from ww w.j a  va2  s . co  m*/
    PreparedStatement selectSurveyWithIdStmt = null;
    PreparedStatement deleteSurveyForImeiStmt = null;
    Connection conn = null;
    try {
        conn = getDbConnection();
        selectSurveyWithIdStmt = conn.prepareStatement(SELECT_SURVEY_WITH_ID_STATEMENT,
                ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        selectSurveyWithIdStmt.setString(1, formId);
        ResultSet results = selectSurveyWithIdStmt.executeQuery();
        if (results.first()) {
            result = results.getString(SURVEY_CONTENT_COLUMN);
            // remove survey from available to download for this user
            deleteSurveyForImeiStmt = conn.prepareStatement(DELETE_SURVEYS_FOR_IMEI);
            deleteSurveyForImeiStmt.setString(1, formId);
            deleteSurveyForImeiStmt.setString(2, imei);
            deleteSurveyForImeiStmt.executeUpdate();
        }
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        try {
            selectSurveyWithIdStmt.close();
            conn.close();
        } catch (Exception e) {
        }
    }
    return result;
}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8AttachmentTagTable.java

public MSSBamAttachmentTagBuff[] readBuffByTagIdx(MSSBamAuthorization Authorization, long TagId) {
    final String S_ProcName = "readBuffByTagIdx";
    try {//  w  ww.  jav a2  s  .  c  om
        Connection cnx = schema.getCnx();
        String sql = S_sqlSelectAttachmentTagBuff + "WHERE " + "attg.TagId = " + Long.toString(TagId) + " "
                + "ORDER BY " + "attg.AttachmentId ASC" + ", " + "attg.TagId ASC";
        Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        ResultSet resultSet = stmt.executeQuery(sql);
        List<MSSBamAttachmentTagBuff> buffList = new ArrayList<MSSBamAttachmentTagBuff>();
        while (resultSet.next()) {
            MSSBamAttachmentTagBuff buff = unpackAttachmentTagResultSetToBuff(resultSet);
            buffList.add(buff);
        }
        return (buffList.toArray(new MSSBamAttachmentTagBuff[0]));
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    }
}

From source file:edu.ku.brc.specify.toycode.mexconabio.CopyPlantsFromGBIF.java

/**
 * //from ww w . j  a v  a 2 s.c  o m
 */
public void processNonNullNonPlantKingdom() {
    PrintWriter pw = null;
    try {
        pw = new PrintWriter("gbif_plants_from_nonnull.log");

    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }

    System.out.println("----------------------- Search non-Plantae ----------------------- ");

    String gbifWhereStr = "FROM raw WHERE kingdom = '%s'";

    Vector<String> nonPlantKingdoms = new Vector<String>();
    String sqlStr = "SELECT * FROM (select kingdom, count(kingdom) as cnt from plants.raw WHERE kingdom is not null AND NOT (lower(kingdom) like '%plant%') group by kingdom) T1 ORDER BY cnt desc;";
    for (Object[] obj : BasicSQLUtils.query(sqlStr)) {
        String kingdom = (String) obj[0];
        Integer count = (Integer) obj[1];

        System.out.println(kingdom + " " + count);
        pw.println(kingdom + " " + count);
        if (!StringUtils.contains(kingdom.toLowerCase(), "plant")) {
            nonPlantKingdoms.add(kingdom);
        }
    }

    long startTime = System.currentTimeMillis();

    for (String kingdom : nonPlantKingdoms) {
        String where = String.format(gbifWhereStr, kingdom);

        String cntGBIFSQL = "SELECT COUNT(*) " + where;
        String gbifSQL = gbifSQLBase + where;

        System.out.println(cntGBIFSQL);

        long totalRecs = BasicSQLUtils.getCount(srcConn, cntGBIFSQL);
        long procRecs = 0;
        int secsThreshold = 0;

        String msg = String.format("Query: %8.2f secs",
                (double) (System.currentTimeMillis() - startTime) / 1000.0);
        System.out.println(msg);
        pw.println(msg);
        pw.flush();

        startTime = System.currentTimeMillis();

        Statement gStmt = null;
        PreparedStatement pStmt = null;

        try {
            pStmt = dstConn.prepareStatement(pSQL);

            System.out.println("Total Records: " + totalRecs);
            pw.println("Total Records: " + totalRecs);
            pw.flush();

            gStmt = srcConn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
            gStmt.setFetchSize(Integer.MIN_VALUE);

            ResultSet rs = gStmt.executeQuery(gbifSQL);
            ResultSetMetaData rsmd = rs.getMetaData();

            while (rs.next()) {
                String genus = rs.getString(16);
                if (genus == null)
                    continue;

                String species = rs.getString(17);

                if (isPlant(colStmtGN, colStmtGNSP, genus, species)
                        || isPlant(colDstStmtGN, colDstStmtGNSP, genus, species)) {

                    for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                        Object obj = rs.getObject(i);
                        pStmt.setObject(i, obj);
                    }

                    try {
                        pStmt.executeUpdate();

                    } catch (Exception ex) {
                        System.err.println("For Old ID[" + rs.getObject(1) + "]");
                        ex.printStackTrace();
                        pw.print("For Old ID[" + rs.getObject(1) + "] " + ex.getMessage());
                        pw.flush();
                    }

                    procRecs++;
                    if (procRecs % 10000 == 0) {
                        long endTime = System.currentTimeMillis();
                        long elapsedTime = endTime - startTime;

                        double avergeTime = (double) elapsedTime / (double) procRecs;

                        double hrsLeft = (((double) elapsedTime / (double) procRecs) * (double) totalRecs
                                - procRecs) / HRS;

                        int seconds = (int) (elapsedTime / 60000.0);
                        if (secsThreshold != seconds) {
                            secsThreshold = seconds;

                            msg = String.format(
                                    "Elapsed %8.2f hr.mn   Ave Time: %5.2f    Percent: %6.3f  Hours Left: %8.2f ",
                                    ((double) (elapsedTime)) / HRS, avergeTime,
                                    100.0 * ((double) procRecs / (double) totalRecs), hrsLeft);
                            System.out.println(msg);
                            pw.println(msg);
                            pw.flush();
                        }
                    }
                }
            }

        } catch (Exception ex) {
            ex.printStackTrace();

        } finally {
            try {
                if (gStmt != null) {
                    gStmt.close();
                }
                if (pStmt != null) {
                    pStmt.close();
                }
                pw.close();

            } catch (Exception ex) {

            }
        }
    }
    System.out.println("Done transferring.");
    pw.println("Done transferring.");

}

From source file:net.sourceforge.msscodefactory.v1_10.MSSBamPg8.MSSBamPg8ChainTable.java

public MSSBamChainBuff readBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from  w  ww. j a  v  a  2 s .c  o  m
    try {
        Connection cnx = schema.getCnx();
        long Id = PKey.getRequiredId();
        String sql = S_sqlSelectChainBuff + "WHERE " + "anyo.Id = " + Long.toString(Id) + " ";
        Statement stmt = cnx.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        ResultSet resultSet = stmt.executeQuery(sql);
        if (resultSet.next()) {
            MSSBamChainBuff buff = unpackChainResultSetToBuff(resultSet);
            if (resultSet.next()) {
                resultSet.last();
                throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                        "Did not expect multi-buff response, " + resultSet.getRow() + " rows selected");
            }
            return (buff);
        } else {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    }
}

From source file:fr.bird.bloom.model.GeographicTreatment.java

/**
 * Check if coordinates (latitude and longitude) are included in the country indicated by the iso2 code
 * //from   w w w  . ja  v a  2 s .  co m
 * @return void
 */
public List<String> checkCoordinatesIso2Code() {

    //this.getDarwinCore().associateIdData();

    List<String> listToDelete = new ArrayList<>();

    //Map<String, List<String>> idAssoData = this.getDarwinCore().getIdAssoData();
    final String resourcePath = BloomConfig.getResourcePath();
    List<String> idList = this.getDarwinCore().getID();
    //int iLatitude = this.getDarwinCore().getIndiceFromTag("decimalLatitude_");
    //int iLongitude = this.getDarwinCore().getIndiceFromTag("decimalLongitude_");
    //int iIso2 = this.getDarwinCore().getIndiceFromTag("countryCode_");
    //int iGbifID = this.getDarwinCore().getIndiceFromTag("gbifID_");

    int nbWrongIso2 = 0;
    List<String> listIDtoDelete = new ArrayList<>();
    for (int i = 0; i < idList.size(); i++) {
        String id_ = idList.get(i);
        //System.out.println(id_);
        //for (String id_ : idAssoData.keySet()) {
        //System.out.println(id_);
        if (!"id_".equals(id_)) {
            //List<String> listInfos = idAssoData.get(id_);
            boolean errorIso = true;
            boolean errorCoord = false;
            float latitude = -1;
            float longitude = -1;
            String iso2 = "error";
            String gbifId_ = "error";
            String iso3 = "error";

            String valueLatitude = this.getDarwinCore().getValueFromColumn("decimalLatitude_",
                    id_.replaceAll("\"", ""));
            System.err.println("decimalLatitude : " + valueLatitude);
            if (!valueLatitude.equals("error")) {
                try {
                    latitude = Float.parseFloat(valueLatitude.replaceAll("\"", ""));
                } catch (NumberFormatException ex) {
                    errorCoord = true;
                }
            }

            String valueLongitude = this.getDarwinCore().getValueFromColumn("decimalLongitude_",
                    id_.replaceAll("\"", ""));
            if (!valueLongitude.equals("error")) {
                try {
                    longitude = Float.parseFloat(valueLongitude.replaceAll("\"", ""));
                } catch (NumberFormatException ex) {
                    errorCoord = true;
                }
            }

            iso2 = this.getDarwinCore().getValueFromColumn("countryCode_", id_.replaceAll("\"", ""))
                    .replaceAll("\"", "");
            //gbifId_ = this.getDarwinCore().getValueFromColumn("gbifID_", id_.replaceAll("\"", "")).replaceAll("\"", "");

            if (!iso2.equals("error") && !errorCoord) {
                iso3 = this.convertIso2ToIso3(iso2);

                /*
                try {
                   latitude = Float.parseFloat(listInfos.get(iLatitude).replace("\"", ""));
                }
                catch (NumberFormatException nfe){
                   System.err.println(listInfos.get(iLatitude).replace("\"", ""));
                }
                longitude = Float.parseFloat(listInfos.get(iLongitude).replace("\"", ""));
                iso2 = listInfos.get(iIso2);
                */

                //gbifId_ = listInfos.get(iGbifID);
                if (!iso3.equals("error")) {
                    File geoJsonFile = new File(
                            resourcePath + "gadm_json/" + iso3.toUpperCase() + "_adm0.json");
                    GeometryFactory geometryFactory = new GeometryFactory();
                    Point point = geometryFactory.createPoint(new Coordinate(longitude, latitude));
                    System.out.println("--------------------------------------------------------------");
                    System.out.println("------------------ Check point in polygon --------------------");
                    System.out.println("Lat : " + latitude + "\tLong : " + longitude);
                    System.out.println("id_ : " + id_ + "\tIso3 : " + iso3 + "\tiso2 : " + iso2);

                    boolean isContained = this.polygonContainedPoint(point, geoJsonFile);

                    System.out.println("The point is contained in the polygone : " + isContained);
                    System.out.println("--------------------------------------------------------------\n");

                    if (!isContained) {
                        errorIso = true;
                        //nbWrongIso2 ++;
                        //listIDtoDelete.add(id_);
                    } else {
                        errorIso = false;
                    }
                } else {
                    errorIso = true;
                }
            } else {
                errorIso = true;
            }

            if (errorIso) {
                nbWrongIso2++;
                listIDtoDelete.add(id_);
            }
        }
    }
    if (listIDtoDelete.size() > 0) {
        String sqlIDCleanToSelect = "SELECT abstract_,acceptedNameUsage_,acceptedNameUsageID_,accessRights_,accrualMethod_,accrualPeriodicity_,accrualPolicy_,"
                + "alternative_,associatedMedia_,associatedOccurrences_,associatedOrganisms_,associatedReferences_,associatedSequences_,associatedTaxa_,audience_,"
                + "available_,basisOfRecord_,bed_,behavior_,bibliographicCitation_,catalogNumber_,class_,classKey_,collectionCode_,collectionID_,conformsTo_,continent_,"
                + "contributor_,coordinateAccuracy_,coordinatePrecision_,coordinateUncertaintyInMeters_,country_,countryCode_,county_,coverage_,created_,creator_,"
                + "dataGeneralizations_,datasetID_,datasetKey_,datasetName_,date_,dateAccepted_,dateCopyrighted_,dateIdentified_,dateSubmitted_,day_,decimalLatitude_,"
                + "decimalLongitude_,depth_,depthAccuracy_,description_,disposition_,distanceAboveSurface_,distanceAboveSurfaceAccuracy_,dynamicProperties_,"
                + "earliestAgeOrLowestStage_,earliestEonOrLowestEonothem_,earliestEpochOrLowestSeries_,earliestEraOrLowestErathem_,earliestPeriodOrLowestSystem_,"
                + "educationLevel_,elevation_,elevationAccuracy_,endDayOfYear_,establishmentMeans_,event_,eventDate_,eventID_,eventRemarks_,eventTime_,extent_,family_,"
                + "familyKey_,fieldNotes_,fieldNumber_,footprintSpatialFit_,footprintSRS_,footprintWKT_,format_,formation_,gbifID_,genericName_,genus_,genusKey_,"
                + "geodeticDatum_,geologicalContext_,geologicalContextID_,georeferencedBy_,georeferencedDate_,georeferenceProtocol_,georeferenceRemarks_,"
                + "georeferenceSources_,georeferenceVerificationStatus_,group_,habitat_,hasCoordinate_,hasFormat_,hasGeospatialIssues_,hasPart_,hasVersion_,"
                + "higherClassification_,higherGeography_,higherGeographyID_,highestBiostratigraphicZone_,identification_,identificationID_,identificationQualifier_,"
                + "identificationReferences_,identificationRemarks_,identificationVerificationStatus_,identifiedBy_,identifier_,idFile_,individualCount_,individualID_,"
                + "informationWithheld_,infraspecificEpithet_,institutionCode_,institutionID_,instructionalMethod_,isFormatOf_,island_,islandGroup_,isPartOf_,"
                + "isReferencedBy_,isReplacedBy_,isRequiredBy_,issue_,issued_,isVersionOf_,kingdom_,kingdomKey_,language_,lastCrawled_,lastInterpreted_,lastParsed_,"
                + "latestAgeOrHighestStage_,latestEonOrHighestEonothem_,latestEpochOrHighestSeries_,latestEraOrHighestErathem_,latestPeriodOrHighestSystem_,license_,"
                + "lifeStage_,lithostratigraphicTerms_,livingSpecimen_,locality_,locationAccordingTo_,locationID_,locationRemarks_,lowestBiostratigraphicZone_,"
                + "machineObservation_,materialSample_,materialSampleID_,maximumDepthinMeters_,maximumDistanceAboveSurfaceInMeters_,maximumElevationInMeters_,"
                + "measurementAccuracy_,measurementDeterminedBy_,measurementDeterminedDate_,measurementID_,measurementMethod_,measurementOrFact_,measurementRemarks_,"
                + "measurementType_,measurementUnit_,mediator_,mediaType_,medium_,member_,minimumDepthinMeters_,minimumDistanceAboveSurfaceInMeters_,"
                + "minimumElevationInMeters_,modified_,month_,municipality_,nameAccordingTo_,nameAccordingToID_,namePublishedIn_,namePublishedInID_,namePublishedInYear_,"
                + "nomenclaturalCode_,nomenclaturalStatus_,occurrence_,occurrenceDetails_,occurrenceID_,occurrenceRemarks_,occurrenceStatus_,order_,orderKey_,organism_,"
                + "organismID_,organismName_,organismRemarks_,organismScope_,originalNameUsage_,originalNameUsageID_,otherCatalogNumbers_,ownerInstitutionCode_,"
                + "parentNameUsage_,parentNameUsageID_,phylum_,phylumKey_,pointRadiusSpatialFit_,preparations_,preservedSpecimen_,previousIdentifications_,protocol_,"
                + "provenance_,publisher_,publishingCountry_,recordedBy_,recordNumber_,references_,relatedResourceID_,relationshipAccordingTo_,"
                + "relationshipEstablishedDate_,relationshipRemarks_,relation_,replaces_,reproductiveCondition_,requires_,resourceID_,resourceRelationship_,"
                + "resourceRelationshipID_,rights_,rightsHolder_,samplingEffort_,samplingProtocol_,scientificName_,scientificNameAuthorship_,scientificNameID_,sex_,"
                + "source_,spatial_,species_,speciesKey_,specificEpithet_,startDayOfYear_,stateProvince_,subgenus_,subgenusKey_,subject_,tableOfContents_,taxon_,"
                + "taxonConceptID_,taxonID_,taxonKey_,taxonomicStatus_,taxonRank_,taxonRemarks_,temporal_,title_,type_,typeStatus_,typifiedName_,valid_,"
                + "verbatimCoordinates_,verbatimCoordinateSystem_,verbatimDate_,verbatimDepth_,verbatimElevation_,verbatimEventDate_,verbatimLatitude_,"
                + "verbatimLocality_,verbatimLongitude_,verbatimSRS_,verbatimTaxonRank_,vernacularName_,waterBody_,year_ FROM Workflow.Clean_"
                + this.getUuid() + " WHERE Clean_" + this.getUuid() + ".id_=";

        String sqlIDCleanToDelete = "DELETE FROM Workflow.Clean_" + this.getUuid() + " WHERE id_=";
        for (int l = 0; l < listIDtoDelete.size(); l++) {
            if (l != listIDtoDelete.size() - 1) {
                sqlIDCleanToDelete += listIDtoDelete.get(l) + " OR id_=";
                sqlIDCleanToSelect += listIDtoDelete.get(l) + " OR Clean_" + this.getUuid() + ".id_=";
            } else {
                sqlIDCleanToDelete += listIDtoDelete.get(l) + ";";
                sqlIDCleanToSelect += listIDtoDelete.get(l) + ";";
            }
        }
        Statement statement = null;
        try {
            statement = ConnectionDatabase.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        DatabaseTreatment newConnectionSelectID = new DatabaseTreatment(statement);
        List<String> messagesSelectID = new ArrayList<>();
        //String sqlSelectID =  + id_ + ";";
        messagesSelectID.add("\n--- Select wrong matching between polygon and Iso2 code ---\n");
        messagesSelectID.addAll(newConnectionSelectID.executeSQLcommand("executeQuery", sqlIDCleanToSelect));
        //messagesSelectID.add(sqlIDCleanToSelect);
        for (int j = 0; j < messagesSelectID.size(); j++) {
            System.out.println(messagesSelectID.get(j));
        }

        List<String> selectIDResults = newConnectionSelectID.getResultatSelect();
        for (int k = 0; k < selectIDResults.size(); k++) {
            if (!listToDelete.contains(selectIDResults.get(k))) {
                listToDelete.add(selectIDResults.get(k));
            }
        }
        Statement statementDelete = null;
        try {
            statementDelete = ConnectionDatabase.getConnection()
                    .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        DatabaseTreatment newConnectionDeleteID = new DatabaseTreatment(statementDelete);
        List<String> messagesDeleteID = new ArrayList<>();
        //String sqlDeleteID = "DELETE FROM Workflow.Clean_" + this.getUuid() + " WHERE id_=" + id_ + ";";
        messagesDeleteID.add("\n--- Delete wrong matching between polygon and Iso2 code ---\n");
        messagesDeleteID.addAll(newConnectionDeleteID.executeSQLcommand("executeUpdate", sqlIDCleanToDelete));
        List<String> deleteIDResults = newConnectionDeleteID.getResultatSelect();
        messagesDeleteID.add("nb lignes affectes :" + listToDelete.size());
        for (int i = 0; i < messagesDeleteID.size(); i++) {
            System.out.println(messagesDeleteID.get(i));
        }

    }

    this.setNbWrongIso2(nbWrongIso2);

    return listToDelete;
}