srikotesh
asked on
how to get the content from BLOB datatype in java
HI Experts,
I have a table in database for that table one of the column is of type BLOB.
this column contains some data. how to get the data from this column.
Can any one suggest how to do
Thanks
I have a table in database for that table one of the column is of type BLOB.
this column contains some data. how to get the data from this column.
Can any one suggest how to do
Thanks
ASKER
i am not using result set
i am getting the value from the database
now i have to get the value
Object master = dao.getTableDetails();
if(master ! = null)
{
//here i have to get the value
byte[] data =(Blob) row[0];
//here i am getting class cast exception
}
i am getting the value from the database
now i have to get the value
Object master = dao.getTableDetails();
if(master ! = null)
{
//here i have to get the value
byte[] data =(Blob) row[0];
//here i am getting class cast exception
}
ASKER
Blob blobdata = (Blob) row[0];
byte[] data = blobdata.getBytes()
i have tried like this also
byte[] data = blobdata.getBytes()
i have tried like this also
What type of object is that row variable?
ASKER
blob type
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
can you post your full code listing.
ASKER
from the database I am getting data type as byte array,not blob.
I have converted that byte array to blob then I converted blob to string.
I have converted that byte array to blob then I converted blob to string.
from the database I am getting data type as byte array,not blob.
I have converted that byte array to blob then I converted blob to string.
So you solved it yourself?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi CPcolin,
Yes issue is resolved.
Hi gheist,
That might be the reason .
Yes issue is resolved.
Hi gheist,
That might be the reason .
You worked around the issue, which is good result. If you do not intend to fix BLOB support in your DB you can close now.
ASKER
i found solution my own with the help of CPcolin.
You can also call getBinaryStream() on the ResultSet object directly.