1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Statement instruction = connection.createStatement();
String sql = " SELECT RIB.NOM, TEZ.MONTANT FROM RIB,TEZ where RIB.MAT=TEZ.MAT; ";
ResultSet resultat = instruction.executeQuery(sql);
while (resultat.next()) {
try
{
File fichier = new File("c:\\fichier.txt") ;
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(fichier)));
String nom =resultat.getString("NOM"); out.write("Bonjourbbbbbbbbbbbbbb "+nom) ;
out.println() ;
out.write("Comment allez vous") ;
out.close() ;
}
catch (IOException exception)
{
System.out.println ("Erreur lors de la lecture : " + exception.getMessage());
}
}
}
catch (Exception ex) {
ex.printStackTrace() ; |
Partager