Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

After WLS10.3 migration getBinaryStream in Oracle.sql.BLOB not reading data

User_LHTJAFeb 4 2011 — edited Feb 4 2011
Please some one help me. After the 10.3 migration, the values in CSV file(as BLOB in DATABASE) is not read by getBinaryStream method. It returns 0. It was working before. Please find below the code:

import oracle.jdbc.OracleResultSet;
import oracle.sql.BLOB;
public InputStream RetriveISfromBlob(int batchid)
{
BLOB blob;
InputStream instream=null;

try
{

Statement stmt = connection.createStatement ();
ResultSet resSet = stmt.executeQuery
("SELECT content FROM file_upload WHERE batch_id="+batchid);
resSet.next();
System.out.println("after query");
/*Get the BLOB locator.*/
blob = ((OracleResultSet)resSet).getBLOB(1);
/*get the blob's outputstream
any data read from this stream comes from the BLOB*/
instream = blob.getBinaryStream();

Below is code from Another class which call the above method RetriveISfromBlob:

InputStream inputstream = fileDataDAO.RetriveISfromBlob(batchId);
System.out.println("afterfileread");
CommaFileInputStream reader = new CommaFileInputStream(inputstream);
reader.setIgnoreFirstLine(true);
CommaRecord comma = reader.getCommaRecord();

System.out.println("Number of records -" + comma.size()); /This returns o but CSV file has lot of datas


NOTE: When I use Ojdbc14.jar only the above code returns 0. When i use Ojdbc_6g.jar it throws NULL POINTER EXCEPTION because the code was written like import oracle.jdbc.driver.OracleResultSet; But in all cases the data in BLOB was not read

Edited by: 833987 on Feb 4, 2011 9:07 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2011
Added on Feb 4 2011
0 comments
97 views