javaoracle-databasejdbctimestampcachedrowset

Oracle 1.8 CachedRowSet.populate error where select systimestamp from dual


I have a simple question... Why this code below is not working?

The stack trace:

java.sql.SQLException: Invalid SQL type for column
at javax.sql.rowset.RowSetMetaDataImpl.checkColType(RowSetMetaDataImpl.java:114)
at javax.sql.rowset.RowSetMetaDataImpl.setColumnType(RowSetMetaDataImpl.java:459)
at com.sun.rowset.CachedRowSetImpl.initMetaData(CachedRowSetImpl.java:761)
at com.sun.rowset.CachedRowSetImpl.populate(CachedRowSetImpl.java:639)

The line "rowset.populate(rs);" throws a "java.sql.SQLException: Invalid SQL type for column"

The error occurs when I try to execute the query:

select systimestamp from dual

But if I use the code below instead of "rowset.populate(rs);", it works:

rs.getTimestamp(1)

And if I try to execute the query below, everything works well:

select sysdate from dual

So, how can I use the rowset.populate(rs) to get the syscurrenttimestamp?

I start to think that it is a bug of oracle's jdbc implementation...

Sorry about my bad english :)


Solution

  • As @krokodilko suggests, I will post here my comment as an answer:

    I ended up solving the problem with a palliative solution. Instead of performing the query to return a TIMESTAMP, I made it to return a STRING:

    SELECT TO_CHAR(SYSTIMESTAMP, 'DD/MM/YYYY HH24:MI:SS.SSXFF TZR') FROM DUAL
    

    And then I had to do a parse to TIMESTAMP. I know that it's ugly, but is just until we find a correct solution. I still have hope that someone will help us with this matter.