This is my function in my database that insert one user.
public Utente aggiungiUtente(char[] tempo, char[] id_utente, int x, int y, int z, int id_stanza) throws SQLException {
Connection c = null;
PreparedStatement s = null;
ResultSet r = null;
Utente risultato = null;
try {
c = creaConnessione();
s = c.prepareStatement("INSERT INTO UTENTE(time, id_utente, x, y, z, id_stanza) values (?,?,?,?,?,?) ", Statement.RETURN_GENERATED_KEYS);
String tempoString = tempo.toString();
String idUtenteString = id_utente.toString();
// s.set..(1, tempo);
// s.set..(2, id_utente);
s.setInt(3,x);
s.setInt(4,y);
s.setInt(5,z);
s.setInt(6,id_stanza);
s.execute();
r = s.getGeneratedKeys();
r.next();
risultato = factory.creaUtente(tempo, id_utente, x, y, z, id_stanza);
} catch (SQLException e) {
disconnetti(c,s,r);
throw e;
}
disconnetti(c,s,r);
return risultato;
}
But I don't know how to set char array. At the creation of database I build them as VARCHAR and for my project I need to do this. I tried to set them as: s.setString(tempo.toString);but within the database will insert a strange thing like this: [C@76ccd017 Who can help me please??