sql = String.format(“INSERT INTO filme (nome, nacionalidade, copias, " VALUES (’%s’, ‘%s’, ‘%d’, 'SELECT id FROM categoria” +
+ “categoria)
" WHERE nome = ‘%s’’)”, f.getNome(), f.getNacionalidade(),
f.getCopias(), f.getCategoria());
ou seja:
INSERT INTO filme (nome, nacionalidade, copias, categoria) VALUES (‘James bond’, ‘brasil’, ‘10’, ‘SELECT id FROM categoria WHERE nome = ‘Futebol’’)
que resulta:
Exception in thread “main” java.sql.SQLException: 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 ‘Futebol’’)’ at line 1
o que fazer?