Oracle JDBC Driver and Spring 2.0.X Timestamp issue

Oracle JDBC Driver (ojdbc14.jar)

Spring Framework 2.0


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 ( {
    System.out.println("-> " + 

Our batch process failed last night because of this…

Oracle JDBC: Implicit Connection Caching bug exposed


Note. Following code behaves equal in standalone or application server environments.

Right way

// IBM's example
// The following property ordering results in
// a cache being created.

OracleDataSource ods = new OracleDataSource();

ods.setURL("jdbc:" + "oracle:thin:@localhost:1521:IBM");


Wrong way

// ORACLE's example
// The following property ordering causes no exception,
// but no cache is created.

// create a DataSource
OracleDataSource ods = new OracleDataSource();

// set cache properties
java.util.Properties prop = new java.util.Properties();
prop.setProperty("MinLimit", "2");
prop.setProperty("MaxLimit", "10");

// set DataSource properties
String url = "jdbc:" + "oracle:thin:@";
ods.setConnectionCachingEnabled(true); // be sure set to true
ods.setConnectionCacheProperties (prop);
ods.setConnectionCacheName("ImplicitCache01"); // this cache's name

Oracle documentation includes an example with the incorrect order and has no reference to the bug!