Re: CachedRowSetImpl.getTimestamp() throwing exception



Thanx for sharing code. Yeah, i think oracle guys fixed that bug in new
driver version. However there is an alernate solution to the problem if
u r still using 9.2* version of drivers i.e oracle does its own
implementation CachedRowSet (look for OracleCachedRowSet in oro*.jar
file shipped with installation, sorry can't remember exact jar file
name) and that takes care of TimeStamp related issue.I was using Sun
implementation of CachedRowSet with Oracle db, hence faced that
exception.

bjorn.ahl@xxxxxxxxx wrote:
I Tested that with oracle Jdbc version 10.2.0.1 and gott it to work. :D

My Test code
import java.sql.Timestamp;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.sun.rowset.CachedRowSetImpl;
import java.sql.Date;


public class CachedRowSetImplTest {

public static void main(String args []) {
CachedRowSetImplTest runMe = new CachedRowSetImplTest();
}
/** Creates a new instance of CachedRowSetImplTest */
public CachedRowSetImplTest() {

Connection conn;
try {

DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
} catch (SQLException ex) {
ex.printStackTrace();
}
try {
conn =
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ora10gr2",
"scott", "tiger");
} catch( Exception e ) {
System.out.println( "error connecting" );
e.printStackTrace( );
return;
}
try {
// Create a Statement
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select ename, hiredate
from emp");
CachedRowSetImpl crs = new CachedRowSetImpl();
crs.populate(rset);
System.out.print("test");
while (crs.next()) {
//java.sql.TimeStamp =
Timestamp myTimeStamp = crs.getTimestamp("HIREDATE");
// EOD_DATE coulmn is of type DATE, this line is throwing
System.out.println(crs.getTimestamp("HIREDATE"));

}
} catch (SQLException ex) {
ex.printStackTrace();
}
}

.



Relevant Pages

  • RE: ORACLE DRIVER
    ... DBI - is the perl module to handle all the request of the database, connecting, disconnecting, routing the database request to proper driver. ... DBD::Oracle - is the Oracle driver that DBI can use to handle oracle request. ...
    (perl.dbi.users)
  • RE: ORACLE DRIVER
    ... Subject: ORACLE DRIVER ... DBI - is the perl module to handle all the request of the database, ... So is there any free Oracle ODBC driver for Linux? ...
    (perl.dbi.users)
  • Re: Microfocus Netexpress question : COBSQL vs openESQL
    ... >couldnt connect with the oracle database specified in the program. ... It may be missing an ODBC driver and/or data source. ... You also need an entry for the data source in tnsnames.ora. ... precompiler directives to the precompiler and compiler directives to ...
    (comp.lang.cobol)
  • Re: DTS for Oracle through ODBC: Error Calling GetNextRows in Prev
    ... I found out the Oracle driver they had installed on my system was for Oracle ... installer app in order to install their ODBC's.. ... I decided to use the Oracle ODBC provided in their client install. ...
    (microsoft.public.sqlserver.dts)
  • Re: Oracle jdbc perf on linux and windows
    ... >> an Oracle configuration problem. ... particular SQL statement as well on Linux as it does on Windows/MacOS? ... What driver are you using? ...
    (comp.lang.java.programmer)