Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please Help: CachedRowSetImpl (JSR-114) with Oracle Type4 Driver

 
Samuel Johnson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have anyone tried the Sun's new(well, maybe not that new) CachedRowSet RI with Oracle type4 driver (thin driver)? I can't get com.sun.rowset.CachedRowSetImpl to work with the Oracle9i. My code works fine with the MySQL4.0+ type 4 driver and Oracle9i+ Jdbc-Odbc bridge. It always throws the following exception at "rowset.execute()"

java.sql.SQLException: Invalid scale size. Cannot be less than zero
at javax.sql.rowset.RowSetMetaDataImpl.setScale(Unknown Source)
at com.sun.rowset.CachedRowSetImpl.initMetaData(Unknown Source)
at com.sun.rowset.CachedRowSetImpl.populate(Unknown Source)
at com.sun.rowset.internal.CachedRowSetReader.readData(Unknown Source)
at com.sun.rowset.CachedRowSetImpl.execute(Unknown Source)
at com.sun.rowset.CachedRowSetImpl.execute(Unknown Source)
at RowSetTest1.main(RowSetTest1.java:60)

My code looks like this

Class.forName(driverName);
CachedRowSet rowset = new CachedRowSetImpl();
rowset.setReadOnly(false);
rowset.setUrl(url);
rowset.setUsername(userId);
rowset.setPassword(password);
rowset.setCommand(sql);
rowset.setTableName("emp");
rowset.execute();

Thanks
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm. I had a quick look at the Oracle site, and they appear to prefer their own implementation, but then they would, wouldn't they?

The thing I don't like about their code is that it breaks the intent of the 'database neutrality" of JDBC. Is there a factory for RowSet implementations? I had a look in the API and there doesn't seem to be one. I'll have a look at the JDBC API Tutorial and Reference book when I get home tonight.
 
Samuel Johnson
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your replay. Yes, like you said, "Database neutrality". I have tried the Oracle's own implementation. It works fine except that "CachedRowSet rowset = new OracleCachedRowSet()" cause a compilation error which breaks the whole idea of using JDBC.

The closest thing I can do is using "RowSet rowset = new OracleCachedRowSet()". Please let me know if you found anything about using CachedRowSet. Thank you.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No luck. The JDBC book only refers to the standard implementation. I'm surprised there doesn't appear to be a factory of some sort that allows the RowSet to be sourced from the current Driver if required.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic