Error Unknown column 'undefined' in 'where clause'

0

Good morning,

I have a table created through java code. The table is created without any type of error, but when I go to MySQL and pulse 2 times on any cell, it shows me a popup that indicates Unknown column 'undefined' in 'where clause' . In addition, those cells that have more than X letters are not shown complete. I leave an image to be visual:

The code that you have the following:

public class Conectate {
private String driver ="com.mysql.jdbc.Driver";
private String cadenaConexion ="jdbc:mysql://localhost/XboxOne";
private String pass = "";
private String usuario = "root";
public Connection con;

public Conectate(Map<String,  Map<String, Item>> gamesByCountry, Map<String, String> codesByTitle,Map<String, String> countries) {
    try {
        Class.forName(driver);
        con = DriverManager.getConnection(cadenaConexion, usuario, pass);
        System.out.println("¡Conectado!");


        //CREAMOS LA TABLA
        Statement st = con.createStatement();

        st.executeUpdate("CREATE TABLE IF NOT EXISTS info_XboxOne (id INT AUTO_INCREMENT, PRIMARY KEY(id), "
                + "Juego_vinculado VARCHAR(500), Juego VARCHAR(500), Tipologia VARCHAR (500), Pertenece VARCHAR (500), "
                + "Nota VARCHAR (10), Descripcion_Ingles TEXT(4000), Descripcion_Castellano TEXT(4000), Pegi VARCHAR(10), Descripcion_Pegi VARCHAR(200),"
                + "Lanzamiento VARCHAR (50))");

        System.out.println( "Tabla creada!");

        PreparedStatement ps = con.prepareStatement("INSERT INTO info_XboxOne (Juego, Tipologia, Pertenece, "
                + "Nota, Descripcion_Ingles, Descripcion_Castellano, Pegi, Descripcion_Pegi, Lanzamiento"
            + ") VALUES (?,?,?,?"
            + ",?,?,?,?,?"
            + ")");


        for (String titulo : codesByTitle.keySet()) {                 
            String code = codesByTitle.get(titulo);
                for (String country : countries.keySet()) {
            Item game = gamesByCountry.get(country).get(code);

                            if (country.equals("Estados Unidos")) {                                  
                                ps.setString(1,titulo);
                            }

            if (game != null) {

                                    if (country.equals("Estados Unidos")) {
                                        ps.setString(2,game.getValues().get(Constants.TIPOLOGIA));
                                        ps.setString(3,game.getValues().get(Constants.PERTENECE));                                            
                                        ps.setString(4,game.getValues().get(Constants.NOTA));
                                        ps.setString(9,game.getValues().get(Constants.FECHA));
                                        ps.setString(5,game.getValues().get(Constants.DESCRIPCION_INGLES));
                                    }

                                    if (country.equals("España")) {
                                        ps.setString(6,game.getValues().get(Constants.DESCRIPCION_CASTELLANO));
                                        ps.setString(7,game.getValues().get(Constants.PEGI));
                                        ps.setString(8,game.getValues().get(Constants.DESCRIPCION_PEGI));
                                    }

            }
                }
                ps.executeUpdate();
        }


    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, "No se ha podido establecer la conexión con la DB" + e);
    }

}

public String ConvertirObjectToString(Object Obj) {
String Str="";
if(Obj!=null){
    Str = Obj.toString();
}
return Str;
}


}

Something will have to be wrong, but I can not find the solution.

    
asked by JetLagFox 24.02.2017 в 22:40
source

0 answers