The main reason this problem baffles me is because I even included a piece of code that prevents records from being added if they already exist. And I'm almost certain the update just gets executed twice, for some reason. I've also checked that the method calling the FillDatabase method isn't in some kind of loop, but it's just the basic public method that gets executed when the class is instantiated. And it's only instantiated once.

So here's the code of my database filling method that seems to add each record twice in a row.

```
    public void FillDatabase(String filename) {
    try {
        Statement statement = dbConnection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
        String sql = "SELECT * FROM OTH";
        ResultSet resultSet = statement.executeQuery(sql);

        resultSet.first();

        String file = "C:\\Users\\Desktop\\" + filename +".sql";

        try(BufferedReader br = new BufferedReader(new FileReader(file))) {
            for(String line; (line = br.readLine()) != null; ) {
                line = line.substring(line.indexOf("VALUES") + 7, line.length() - 2);
                String[] parts = line.split(",");

                parts[1] = parts[1].replaceAll("'", "");
                parts[2] = parts[2].replaceAll("'", "");
                parts[3] = parts[3].replaceAll("'", "");
                parts[4] = parts[4].replaceAll("'", "");
                parts[5] = parts[5].replaceAll("'", "");
                parts[6] = parts[6].replaceAll("'", "");
                parts[7] = parts[7].replaceAll("'", "");
                parts[8] = parts[8].replaceAll("'", "");
                parts[9] = parts[9].replaceAll("'", "");
                parts[10] = parts[10].replaceAll("'", "");
                parts[11] = parts[11].replaceAll("'", "");
                parts[12] = parts[12].replaceAll("'", "");

                resultSet.last();
                int resultSetSize = resultSet.getRow();
                resultSet.first();

                boolean addToDatabase = true;

                for (int i = 0; i < resultSetSize; i++) {
                    if (resultSet.getString("filename").equals(parts[9])) { // If duplicate has been found
                        addToDatabase = false;
                        break;
                    }
                    resultSet.next();
                }

                if (addToDatabase) {
                    resultSet.moveToInsertRow();

                    resultSet.updateString("entity", parts[1].replaceAll("'", ""));
                    resultSet.updateFloat("s_val", Float.parseFloat(parts[2].replaceAll("'", "")));
                    resultSet.updateString("bdate", parts[3].replaceAll("'", ""));
                    resultSet.updateString("edate", parts[4].replaceAll("'", ""));
                    resultSet.updateInt("il", Integer.parseInt(parts[5].replaceAll("'", "")));
                    resultSet.updateInt("ih", Integer.parseInt(parts[6].replaceAll("'", "")));
                    resultSet.updateInt("jl", Integer.parseInt(parts[7].replaceAll("'", "")));
                    resultSet.updateInt("jh", Integer.parseInt(parts[8].replaceAll("'", "")));
                    resultSet.updateString("filename", parts[9].replaceAll("'", ""));
                    resultSet.updateString("source", parts[10].replaceAll("'", ""));
                    resultSet.updateString("contact", parts[11].replaceAll("'", ""));
                    resultSet.updateString("email", parts[12].replaceAll("'", ""));

                    resultSet.insertRow();
                }
            }

            statement.close();
            resultSet.close();
        } catch (IOException ex) {
            System.out.println(ex.getMessage());
        }
    } catch (SQLException err) {
        System.out.println(err.getMessage());
    }
}

```

I could directly run the SQL file that is being used and it would work if the table had the right amount of columns, but the SQL file takes into account for columns that I do not need. So that is why I've included a bufferedreader which reads and separates each line of the .sql file. This is all working just fine because every value is assigned to it's corresponding column. The problem arises when I add the records to the database after that, because they get added twice instead of once. I should clarify that it's not two values being added to one column of the same row, but two identical rows are being added to the database.

My best guess is that perhaps a try-catch inside a try catch is causing the problem. Or because I'm pulling the table into a ResultSet, which I then edit before updating the table again, instead of just adding records with "INSERT INTO OTH". But this kind of method has worked for me in the past, especially when working with C#, so it shouldn't be the cause of this problem, I'm guessing.