'SQL Message Invalid column type: getBLOB not implemented for class oracle.jdbc.driver.T4CLongRawAccessor
I have a problem when trying to read Blob from oracle DB by using this
rs.getBlob("ARCHIVE_REQ_FILE_BLOB")
and also i try this
oracle.sql.BLOB blob= (oracle.sql.BLOB) ((OracleResultSet) rs).getBlob("ARCHIVE_REQ_FILE_BLOB");
the following error appears
SQL Message Invalid column type: getBLOB not implemented for class oracle.jdbc.driver.T4CLongRawAccessor
use IBM WebSphere application server 8.5.5
open connection using WebSphere datasource
using oracle oracle 11.2.0.2
can any one help me thanks all
Solution 1:[1]
You are not trying to read a BLOB
value. You actually have a LONG RAW
value in the database and you are trying to read that as if it were a BLOB
.
I would recommend that you read the Oracle documentation for reading data from LONG
and LONG RAW
values in JDBC. Oracle even provides example code to help you out.
Solution 2:[2]
If your column is really a BLOB, then you need to make sure that in your Java code that you are not defining the column as a LONG_RAW (search for calls to defineColumnType) as this will make the server send the data as a LONG_RAW instead of a BLOB.
Solution 3:[3]
in some cases solvable on an SQL level if the content is not too big for your use case:
select dbms_lob.substr( some_blob, 4000 ) as some_blob
from some_tab
depending on your Oracle db you can choose a higher value for 4000
, but for older versions this should work almost everywhere.
sometimes 3500
is safer because of unicode conversion of some chars to multiple 8-bit characters.
(the above shortens the blob content to 4000 characters, if necessary and converts the blob to some more suitable datatype)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Luke Woodward |
Solution 2 | Jean de Lavarene |
Solution 3 |