This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Please Help: CachedRowSetImpl (JSR-114) with Oracle Type4 Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Please Help: CachedRowSetImpl (JSR-114) with Oracle Type4 Driver" Watch "Please Help: CachedRowSetImpl (JSR-114) with Oracle Type4 Driver" New topic
Author

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

Samuel Johnson
Greenhorn

Joined: Apr 20, 2004
Posts: 5
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

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Apr 20, 2004
Posts: 5
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

Joined: Mar 06, 2001
Posts: 13459

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please Help: CachedRowSetImpl (JSR-114) with Oracle Type4 Driver