I'm trying to read in data from a csv file into a table from a database that I created. I've done it so far for 3 tables so the code for the fourth one should be relatively the same, but I keep receiving the error
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3 at Verbindung.main(Verbindung.java:136)
this should be a pretty simple problem to fix but I can't see where I'm going wrong as the index and number of variables in my array appear to match up fine.
Here is my code
  // Parsing CSV file Facebookapp 
           try {
                Scanner inputStream3 = new Scanner(file3);
                //inputStream.useDelimiter("[;/n]");
                while(inputStream3.hasNext()) {
                    String data3 = inputStream3.next();
                    System.out.println(data3);
                    String[] values3 = data3.split(";");    
                    System.out.println(data3);
                    //if(values.toString().contains(";;;")) break;
                    int PRODNUM = Integer.parseInt(values3[0]);
                    double V_ERSION = Double.parseDouble(values3[1]);
                    String PHONE_ASSOC = values3[2];
                    int accountNUM = Integer.parseInt(values3[3]);
                    //creating the object FBapp with the relevant parameters
                    FBapp fbapp = new FBapp(PRODNUM, V_ERSION, PHONE_ASSOC, accountNUM);
                    facebookapp.add(fbapp);
                    }
                inputStream3.close();
                }
                catch(FileNotFoundException d) {
                d.printStackTrace();
            }
    try {
        // establish connection to database
        Class.forName("oracle.jdbc.driver.OracleDriver");
        String database = "jdbc:oracle:thin:@oracle-lab.cs.univie.ac.at:1521:lab";
        String user = "a01547605";
        String pass = "dbs19";
        Connection con = DriverManager.getConnection(database, user, pass);
        Statement stmt = con.createStatement();
        String sql3 = "INSERT into facebookapp(PRODNUM, V_ERSION, PHONE_ASSOC, accountNUM) values(?,?,?,?)";
        PreparedStatement ps = con.prepareStatement(sql3);
        final int batchSize = 100;
        int count = 0;
        for(FBapp d: facebookapp) {
            ps.setInt(1, d.getPRODNUM());
            ps.setDouble(2, d.getV_ERSION());
            ps.setString(3, d.getPHONE_ASSOC());
            ps.setInt(4, d.getaccountNUM());
            ps.addBatch();
            if(++ count% batchSize == 0) {
                ps.executeBatch();
            }
        }
          ps.close();
      }   
          catch (Exception e) {
          System.err.println(e.getMessage());
          }
My CSV file looks as follows, this is the first row of 100
1   1.00    Iphone  100
also when I print out what is being read out of my CSV file before it cuts out this is what it looks like
1;1.00;Iphone
 
     
    