How i get BLOB field through Oracle Curosr in JSP/JDBC
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ravi_Jain
Posted On:   Friday, February 20, 2004 03:31 AM

I wrote a Oracle Function which return Cursor of ResultSet. In My table there is a BLOB field and I want to get the ResultSet Cursor for this fields. Oracle Function CREATE OR REPLACE FUNCTION FN_GET_MESSAGEVIEW (v_username IN VARCHAR2, v_cid IN VARCHAR2) RETURN types.cursorType AS db_cursor types.cursorType; BEGIN OPEN db_cursor FOR select m.id,m.name,m.createdby,m.createddate,m.display_name,m.description,m.xcomments,m.itemid,m.xComments BLOB field from xMessage m, xMessageHolder mh where mh.itemid = m.id and mh.id = v_cid and mh.username = v_username; RETURN db_cursor; END ;    More>>

I wrote a Oracle Function which return Cursor of ResultSet.
In My table there is a BLOB field and I want to get the ResultSet Cursor for this fields.

Oracle Function


CREATE OR REPLACE FUNCTION FN_GET_MESSAGEVIEW

(v_username IN VARCHAR2, v_cid IN VARCHAR2) RETURN
types.cursorType

AS

db_cursor types.cursorType;

BEGIN

OPEN db_cursor FOR

select m.id,m.name,m.createdby,m.createddate,m.display_name,m.description,m.xcomments,m.itemid,m.xComments BLOB field
from xMessage m, xMessageHolder mh
where mh.itemid = m.id and mh.id = v_cid and mh.username = v_username;

RETURN db_cursor;

END

;

/

JDBC Code in JSP

String query = "begin ? := FN_GET_ALLMESSAGES(?, ?); end;";


conn = DBConnection.getConnection(DBConnection.CCDB);

cblstmt = conn.prepareCall(query);


cblstmt.registerOutParameter(1, OracleTypes.CURSOR);

cblstmt.setString(2, user); //user

cblstmt.setString(3, status); //status

cblstmt.execute();

rs= (ResultSet)cblstmt.getObject(1);


How I get the blob data through ORacle Function?

   <<Less

Re: How i get BLOB field through Oracle Curosr in JSP/JDBC

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, February 22, 2004 07:14 PM

Well, it's just the 10th field of the result set item, right?


You can get a generic JDBC BLOB using standard JDBC, or you can cast your ResultSet to an "OracleResultSet" if you need it to be e.g. an Oracle-specific "CLOB" or "NLOB".

About | Sitemap | Contact