import java.util.Date;
private Date dataInclusao;
public Date getDataInclusao() {
return dataInclusao;
}
public void setDataInclusao(Date dataInclusao) {
this.dataInclusao = dataInclusao;
}
preparedStatement.setDate(5, (Date) harServerLibMud.getDataInclusao());
Com esse código acima, dá o seguinte erro:
[color=red]Exception in thread "main" java.lang.ClassCastException: java.util.Date
at com.br.harvest.dao.HarServerLibMudDaoImpl.incluirServidoresProjeto(HarServerLibMudDaoImpl.java:129)
at com.br.harvest.programas.HarInstallServers.executaProcessoBD(HarInstallServers.java:48)
at com.br.harvest.main.HarServerLibMudExecute.main(HarServerLibMudExecute.java:44)[/color]
Já tentei usar o seguinte:
preparedStatement.setTimestamp(5,harServerLibMud.getDataInclusao()); mas não é aceito pelo eclipse.[color=red]
The method setTimestamp(int, Timestamp) in the type PreparedStatement is not applicable for the arguments (int, Date)[/color]
preparedStatement.setDate(5,harServerLibMud.getDataInclusao());
[color=red]The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments int, Date) [/color]
Eu quero inserir a data atual na tabela e estou usando
dataInclusao = new Date();
esse é o valor que quero gravar na tabela.
alter table HarServerLibMud
add DataInstalacao datetime;
Agradeço se puderem me dar uma ajuda.
abs.

é a mesma coisa c pode conveter de um pra o outro ou vice versa.