-
1. Re: EJB-BLOB problem.
amccullo Feb 20, 2002 8:00 PM (in response to rohit)I am fairly new at this so I may be way off but it is probably better to use the java.sql.Blob class instead of the Oracle specific BLOB object.
Blob blob = rs.getBlob(1);
Your class cast exception comes from the fact that the ResultSet you get back does not inherit from the Oracle version. I don't think you can use JBoss connection pooling and still use the non-standard Oracle functionality. If you need the Oracle functionality you will have to use the DriverManager.getConnection(url). Or at least that is what I have found. -
2. Re: EJB-BLOB problem.
rohit Feb 21, 2002 9:08 AM (in response to rohit)Hello ,
I am intending to save a blob to the table and not retrieve it.The original code saves a blob to the database.
Blob interface which is provided by java.sql.* package doesnt have any method which returns the outputstream object.
That is the reason why I have used BLOB of oracle.sql package. -
3. Re: EJB-BLOB problem.
davidjencks Feb 21, 2002 9:25 AM (in response to rohit)BLOB blob=((OracleResultSet)(rs.getUnderlyingResultSet())).getBLOB(1);
-
4. Re: EJB-BLOB problem.
rohit Feb 21, 2002 3:17 PM (in response to rohit)Thanks.
I tried this code but it throws the following compilation error.
cannot resolve symbol
symbol : method getUnderlyingResultSet ()
location: interface java.sql.ResultSet
BLOB blob=((OracleResultSet)(rs.getUnderlyingResultSet())).getBLOB(1);
Compiler tries to find the method getUnderlyingResultSet() in java.sql.ResultSet interface which it doesnt find hence the error. -
5. Re: EJB-BLOB problem.
amccullo Feb 28, 2002 2:40 PM (in response to rohit)You must cast the 'rs' object to "org.jboss.pool.jdbc.ResultSetInPool" before you can call the getUnderlyingResultSet method.
BLOB blob =
((OracleResultSet)(((org.jboss.pool.jdbc.ResultSetInPool)rs).getUnderlyingResultSet())).getBLOB(1);
Let me know if that works as I have not tried it. -
6. Re: EJB-BLOB problem.
davidjencks Feb 28, 2002 6:36 PM (in response to rohit)Yes, use your imagination;-). You may also need to cast to the Oracle blob type.