1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
String requete = "INSERT INTO Contrat VALUES (null,4,?,'ererererer','1/1/2200','1/1/55554','',now());
if (getFichier().isFile())
{
try {
ps = clu.getConnection().prepareStatement(requete);
flot = new FileInputStream(getFichier());
ps.setBinaryStream(1, flot, (int) getFichier().length());
ps.executeUpdate();
}
catch (SQLException ex) { e = new Erreur(ex.getMessage()); }
catch (FileNotFoundException fnfe ) { e = new Erreur("TODO :fichier non trouve."); }
finally { try {ps.close(); } catch (Exception ex2) {} }
} |