Oracle JDBC Driver and Spring 2.0.X Timestamp issue
Oracle JDBC Driver (ojdbc14.jar)
import org.springframework.jdbc.support.rowset.SqlRowSet;
public class QueryDAO extends JdbcDaoSupport {
public SqlRowSet loadSqlRowSet(String sSQL) {
return getJdbcTemplate().queryForRowSet(sSQL);
}
}
Using Spring JDBC in such way Timestamp fields are recovered without time information (hours, minutes and seconds set to 0). It seems some issue relative to Sun or Oracle, but there is a workaround in order to achieve desired result.
SqlRowSet rset =
jdbcTemplate.queryForRowSet("select cast(sysdate as timestamp) from dual");
while (rset.next()) {
System.out.println("-> " +
((oracle.sql.TIMESTAMP)rset.getObject(1)).timestampValue());
}
Our batch process failed last night because of this…