salve.... ho un problemino...
come faccio ad inserire ciò che contiene lo stringBuffer in una tabella..?
il mio stringBuffer è
metre la chiamata al database ècodice:StringBuffer scriptText = new StringBuffer(); ..........
mi segnala errore nella riga blu...codice:public static void inserisci(StringBuffer scriptText) { String connStr = "jdbc:mysql://localhost:1980/" + "test?user=root&password=nicola"; String statement2 = "INSERT INTO guestbook (message, messageDate) " + "VALUES (?, ?)"; Connection conn = null; String PreparedStatement=null; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(connStr); PreparedStatement stmt2 = conn.prepareStatement(statement2); stmt2.setString(1, scriptText ); stmt2.setObject(2, new java.util.Date()); stmt2.executeUpdate(); stmt2.close(); } catch (ClassNotFoundException e) { e.printStackTrace(); }catch (SQLException e){ e.printStackTrace();} // handle any errors }
sicuramente sbaglio nel passare lo stringbuffer
come faccio a risolvere?
grazie

Rispondi quotando