I have a problem with a button that should be modifying data on my database.
This is the error I'm getting:
"Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 11 >= 11"
I gonna link here the code for the button and some extra things in case anyone ask...
I've checked and yes, everything is okay with the database columns.
Also, the jTable has 11 columns.
colActual = jTableNombre.getSelectedRow();
private void jButtonGuardarNombreActionPerformed(java.awt.event.ActionEvent evt) {
Connection conn = null;
Statement stmt = null;
String nombre = (String) jTableNombre.getModel().getValueAt(colActual,2);
String director=(String) jTableNombre.getModel().getValueAt(colActual,3);
String año = (String) jTableNombre.getModel().getValueAt(colActual,4);
String generos = (String) jTableNombre.getModel().getValueAt(colActual,5);
String actores = (String) jTableNombre.getModel().getValueAt(colActual,6);
String pais = (String) jTableNombre.getModel().getValueAt(colActual,7);
String idioma = (String) jTableNombre.getModel().getValueAt(colActual,8);
String doblaje = (String) jTableNombre.getModel().getValueAt(colActual,9);
String subtitulos = (String) jTableNombre.getModel().getValueAt(colActual,10);
String ubicacion = (String) jTableNombre.getModel().getValueAt(colActual,11);
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
stmt = conn.createStatement();
String sql= "UPDATE MOVIES" +
"SET NOMBRE = '"+nombre+"'"+
"SET DIRECTOR = '"+director+"'"+
"SET AÑO = '"+año+"'"+
"SET GENEROS = '"+generos+"'"+
"SET ACTORES = '"+actores+"'"+
"SET PAIS = '"+pais+"'"+
"SET IDIOMA = '"+idioma+"'"+
"SET DOBLAJE = '"+doblaje+"'"+
"SET SUBTITULOS = '"+subtitulos+"'"+
"SET UBICACION = '"+ubicacion+"'"+
" WHERE ID = '"+id+"'";
stmt.executeUpdate(sql);
}
catch(Exception e) {
System.out.println(e);
}
}