title: java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp
body: <p>I am working on an application that streams ResultSet over a network. I ended up using a CachedRowSetImpl class. But when I connect to an Oracle DB, I get an error like this</p>
  
  <blockquote>
    <p>java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp</p>
  </blockquote>
  
  <p>Please help.</p>
  
  <p>The source code is as follows:</p>
  
  <pre><code>ResultSet res = response.getResultSet(); //resultset from the server
  while (res.next()) {
      Agent agent = new Agent();
      agent.setName(res.getString(2));
      agent.setMobile(res.getString(1));
      agent.setBalance(res.getLong(4));
      agent.setLastUpdate(res.getDate(3)); //date from the result set
      agent.setAccountNumber(res.getString(5));
  }
  </code></pre>
  
  <p>The error ...</p>
  
  <blockquote>
    <p>java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp
    java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp
        at com.sun.rowset.CachedRowSetImpl.getDate(CachedRowSetImpl.java:2139)</p>
  </blockquote>