Ciao a tutti!!!! allora...allora tra le varie guide tra db e FileReader...ho scritto questo cod. fin'ora giusto:
allora...lo script in neretto è quello che non riesco a modificare...praticamente vorrei prendere dal mio db la dir trasformarla in String e copiarlo in "File"....Codice PHP:try {
Class.forName("org.gjt.mm.mysql.Driver");
}
catch (Exception exc) {
System.out.println("Errore - Driver jdbc non presente: "+ exc.getMessage());
}
try {
conn = DriverManager.getConnection("jdbc:mysql://localhost/basi?user=root&password=root");
stmt = conn.createStatement();
//per visualizzare il db
String sql = "SELECT testo FROM anni_50 WHERE id = 3";
rs = stmt.executeQuery(sql);
[B]File f = new File("C://testo.txt");[/B]
BufferedReader br = new BufferedReader(new FileReader(f));
String st = "";
while((st=br.readLine()) != null){
if (!st.startsWith(">")) {
textArea.append(st + "\n");
textArea.setFont(new Font("times new roman", Font.BOLD, 30));
}
}
stmt.close();
conn.close();
}
catch (Exception exc) {
System.out.println("Errore: "+ exc.getMessage());
}
Spero di essere stato chiaro....![]()
![]()

Rispondi quotando

