This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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)
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.
Joined: Apr 20, 2004
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.
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.