After WLS10.3 migration getBinaryStream in Oracle.sql.BLOB not reading data
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