dopo aver chiamato il metodo,devo mettere "titolo" all'interno di:
codice:
private static void inserisci(String fileText, String fileName) throws IOException
{
String titolo;
String connStr =
"jdbc:mysql://localhost:1980/" +
"test?user=root&password=nicola";
String statement2 =
"INSERT INTO guestbook (script, nome, dataEstrazione, Tipo, scopo, provenienza, clientServer, freqUtilizzo) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
Connection conn = null;
String PreparedStatement=null;
try {
title();
FileWriter fileWriter = new FileWriter(fileName);
fileWriter.write(fileText);
fileWriter.flush();
fileWriter.close();
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(connStr);
PreparedStatement stmt2 = conn.prepareStatement(statement2);
stmt2.setString(1, fileText);
stmt2.setString(2, titolo );
stmt2.setObject(3, new java.util.Date());
stmt2.setString(4, "JavaScript");
stmt2.setString(5, null);
stmt2.setString(6, fileName);
stmt2.setString(7, "client");
stmt2.setString(8, null);
if (stmt2.executeUpdate() <= 0) {
System.out.println("Esecuzione UPDATE non riuscita!");
}
stmt2.close();
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}catch (SQLException e){
e.printStackTrace();}
catch (IllegalThreadStateException e){
e.printStackTrace();}
}
e mi segnala errore su titolo dicendo di inizianizzarla... (scusa and!) ma ho un pò di problemi come noti!!!!
alla consegna del progetto(funzionante!) al prof ti mando una bottiglia di vino!!!