How can I update the mysql data from java (netbeans)?

-1

You also have to update an image, this is my code:

PreparedStatement pps = cn.prepareStatement("UPDATE socios SET  (nombre, nosocio, foto, apellido) VALUES (?,?,?,?)");
pps.setString(1, nombre.getText());
pps.setString(2, nosocio.getText());

File imagen=new File(ruta);
FileInputStream fis;
try {
    fis = new FileInputStream (imagen);
    pps.setBinaryStream(3, fis, (int)imagen.length());
} catch (FileNotFoundException ex) {
    Logger.getLogger(nuevacredencial.class.getName()).log(Level.SEVERE, null, ex);
}
pps.setString(4, apellido.getText());
pps.executeUpdate();

I get this error message:

  

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an   error in your SQL syntax; check the manual that corresponds to your   MySQL server version for the right syntax to use near '(name,   nosocio, photo, surname) VALUES ('Juan Miguel', '1', _ binary'ÿØÿà \ 0J 'at   line 1

     

-Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    
asked by Lia 21.12.2018 в 20:32
source

0 answers