I'm posting this as an FYI for those migrating from prior 3.2.x version to the latest
3.2.4 version of JBoss.
The ResultSet class returned from a Statement.executeQuery() (and any other JDBC call)
call is now a org.jboss.resource.adapter.jdbc.WrappedResultSet class type and not the
ResultSet class type that the vendor's JDBC driver would typically return.
The gotcha is that if you need to have the actual ResultSet class from your JDBC
driver in order to use vendor specific methods that are not found in the ResultSet
interface, you can no longer simply cast the ResultSet to your JDBC vendor's ResultSet
class if you obtain that connection via the JBoss connection pools.
For example, in order to fully access BLOB/CLOB fields in Sybase, one must do the
following:
| SybResultSet rs = (SybResultSet) stmt.executeQuery(sql.toString());
| if (rs != null && rs.next()) {
| TextPointer tp = rs.getSybTextPointer("clob_field");
| tp.sendData(bytes, 0, bytes.length, false);
| }
| ...
|
|
The above code no longer works in 3.2.4 since the JBoss specific WrappedResultSet is
now returned. If you attempt to cast the WrappedResultSet to your vendor's
ResultSet, you will get a ClassCastException.
It did work fine in 3.2.3 and I presume earlier versions because the actual vendor's
ResultSet class was returned. I confirmed this in 3.2.3 by simply viewing the result
of a rs.getClass().getName().
Luckily, Adrian, the author of the WrappedResultSet, was wise enough to allow us mere
mortals access to the underlying ResultSet as shown below.
| WrappedResultSet wrs = (WrappedResultSet) stmt.executeQuery(sql.toString());
| SybResultSet rs = (SybResultSet) wrs.getUnderlyingResultSet();
| if (rs != null && rs.next()) {
| TextPointer tp = rs.getSybTextPointer("clob_field");
| tp.sendData(bytes, 0, bytes.length, false);
| }
| ...
|
While the above code does work, I am a bit concerned about relying on the
implementation of the JBoss specific WrappedResultSet. Plus, the JDBC code is no
longer completely portable across app servers.
I looked at the code of the WrappedResultSet and for the most part it seems that it's
function is to toggle between the 1.3 and 1.4 SDK versions where new accessor methods
were added to the 1.4 version of the ResultSet interface.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3837962#3837962
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3837962
-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user