我将文件 PDF 上传到 MySQL 数据库,但更新方法 donc 工作它一直给我一个错误,我试图修复它但无法工作,这就是方法,
public void updateProjet(String location,String img) throws Exception
{
// Créer une connexion JDBC Oracle sur la Base de Données
.. ici connection ..
String cad = "update projet set NomProjet='"+this.getnom_projet()+
"', DateDeb='"+this.getdd()+ "', DateFin='"+this.getdf()+
"', iduser='"+this.getid()+ "',IdProjet='"+this.getnprojet()+
"',?,? where idpro='"+this.getidpro()+"'";
PreparedStatement pStmt = conn.prepareStatement(cad);
pStmt.setString(1, img);
File fichier = new File(location);
FileInputStream io = new FileInputStream(fichier);
pStmt.setBinaryStream(2, (InputStream)io,(int)fichier.length());
pStmt.executeUpdate();
}
错误是:
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 ''Exercices2_corrige_2.pdf',_binary'%PDF-1.4
%Çì�¢
5 0 obj
<</Length 6 0 R/Filter' at line 1
请帮助,非常感谢,