Getting Ora-03115 error in ResultSet

kcwoon
kcwoon used Ask the Experts™
on
I'm trying to query a BLOB field in Oracle 8.0.5 by using JSPSmart upload utilities, it give me an error ORA-03115 in my Resultset query .  I also tried classes111 and classes12 but it still give me the same error.Below is my code. Please advice what is going wrong?

import java.util.* ;
import java.sql.*;
import java.io.* ;
import oracle.jdbc.driver.*;
import oracle.jdbc.OracleResultSet;
import util.*;
import com.jspsmart.upload.*;

.....
java.sql.Connection conn = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:TEST","test","test");
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();

String strSql = "insert into upload(file_id,file_name,creation_date,files) values('" + my_id+ "','" + myFileName+ "','",SYSDATE,'",empty_blob())";
int result = stmt.executeUpdate(strSql);

Resultset rs = stmt.executeQuery("select files from upload where file_id='" + myID + "' for update ");

 if (rs.next()) {
        oracle.sql.BLOB blob = rs.getBLOB("files");
        OutputStream outStream = blob.getBinaryOutputStream();
        inStream.read(bytes);
        outStream.write(bytes);
        outStream.flush();
        stmt.execute("commit");
        outStream.close();
}
        inStream.close();
        stmt.close();
       

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Are you trying to access a Blob over a db link?  If so, Blobs cannot be read over a db link.

Please refer to Chapter 4 in the Oracle8i Application Developers Guide - Large Objects (LOBs) under the section titled: LOB Restrictions. This section lists the invalid and valid operations with regards to remote LOBs.
or click on this link

http://download-west.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76940/adl04mn9.htm#98328

Author

Commented:
I'm not accessing a BLOB over a db link. What other possible problems?
Commented:
You cannot reference the BLOB using a thin jdbc connection using Oracle 8.0.5, you would have to upgrade oracle or use oci8 jdbc connection

Author

Commented:
I will try the oci8 then, will let u know the outcome, thank.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial