Subject | data truncation |
---|---|
Author | fred.vlietstra |
Post date | 2009-02-17T16:06:16Z |
Does anyone know why I get an datatruncation error when using the
setDate method see code below :
stmt = c.prepareStatement(INSERT);
stmt.setString(++i, record.getNota_Recid());
stmt.setString(++i, record.getLid_Recid());
stmt.setInt(++i, record.getFile_ID());
stmt.setDouble(++i, record.getNotaBedrag());
stmt.setDouble(++i, record.getBetaald());
stmt.setString(++i, record.getBetaalRek());
stmt.setDate(++i, convertDate
(record.getNotaDatum()));
stmt.setDate(++i, convertDate
(record.getBetaalDatum()));
stmt.setInt(++i, record.getUitDraai());
stmt.setDouble(++i, record.getSub1());
stmt.setString(++i, record.getReknr1());
stmt.setInt(++i, record.getBtw_Code1());
stmt.setDouble(++i, record.getSub2());
stmt.setString(++i, record.getReknr2());
stmt.setInt(++i, record.getBtw_Code2());
stmt.setDouble(++i, record.getSub3());
stmt.setString(++i, record.getReknr3());
stmt.setDouble(++i, record.getSub4());
stmt.setString(++i, record.getReknr4());
stmt.setInt(++i, record.getGeboekt());
stmt.setString(++i, record.getReferentie());
stmt.setString(++i, record.getOmschrijvingLang
());
stmt.setString(++i, record.getVerNr());
stmt.setInt(++i, record.getNetGeprint());
stmt.executeUpdate();
private java.sql.Date convertDate(Date datum)
{
return new java.sql.Date(datum.getTime());
}
setDate method see code below :
stmt = c.prepareStatement(INSERT);
stmt.setString(++i, record.getNota_Recid());
stmt.setString(++i, record.getLid_Recid());
stmt.setInt(++i, record.getFile_ID());
stmt.setDouble(++i, record.getNotaBedrag());
stmt.setDouble(++i, record.getBetaald());
stmt.setString(++i, record.getBetaalRek());
stmt.setDate(++i, convertDate
(record.getNotaDatum()));
stmt.setDate(++i, convertDate
(record.getBetaalDatum()));
stmt.setInt(++i, record.getUitDraai());
stmt.setDouble(++i, record.getSub1());
stmt.setString(++i, record.getReknr1());
stmt.setInt(++i, record.getBtw_Code1());
stmt.setDouble(++i, record.getSub2());
stmt.setString(++i, record.getReknr2());
stmt.setInt(++i, record.getBtw_Code2());
stmt.setDouble(++i, record.getSub3());
stmt.setString(++i, record.getReknr3());
stmt.setDouble(++i, record.getSub4());
stmt.setString(++i, record.getReknr4());
stmt.setInt(++i, record.getGeboekt());
stmt.setString(++i, record.getReferentie());
stmt.setString(++i, record.getOmschrijvingLang
());
stmt.setString(++i, record.getVerNr());
stmt.setInt(++i, record.getNetGeprint());
stmt.executeUpdate();
private java.sql.Date convertDate(Date datum)
{
return new java.sql.Date(datum.getTime());
}