JBoss Community

Classcast Exception using Oracle Blobs(10g) and JBoss 4.0

created by satwika C in JCA - View the full discussion

Hi all,

 

Im using oracle 10g and JBoss 4.

 

Im getting the following error :

 

 

 

java.lang.ClassCastException

 

 

: oracle.sql.BLOB

 

 

Conn = DBConnector.getConnection();

// Initially inserted an empty_blob() to data base

 

//retrieving the record and locking it.

PreparedStatement pStatement = conn.prepareStatement("Select ............... for Update")

ResultSet result = pStatement.executeQuery();

System.out.println(result.getClass().getName());

 

result.next();

BLOB blob =((OracleResultSet)result).getBLOB(1);

 

OutputStream outStream = blob.setBinaryStream(1L);

 

int size = blob.getBufferSize(); 

byte[] buffer = new byte[size]; 

int length = -1; 

 

while ((length = inputStream.read(buffer)) != -1)

 

outStream.write(buffer, 0, length);

inputStream.close();

outStream.close();

 

 

Ive also tried casting my ResultSet obj with WrappedResultSet of org.jboss.resource.adapter package.

This is also throwing a classcastexception.

 

Please provide a solution.

 

Thanks,

Sat !

Reply to this message by going to Community

Start a new discussion in JCA at Community