Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Calling a stored procedure with BLOB input parameter(Calling a stored procedure with BLOB input parameter)
Calling a stored procedure with BLOB input parameter [message #754185] Tue, 01 November 2011 09:18
Ronny  is currently offline Ronny Friend
Messages: 7
Registered: October 2011
Junior Member
I have a store procedure in DB2

CREATE OR REPLACE PROCEDURE INSERT_MSG (
I_MSG_ID INTEGER,
I_MSG_DATA BLOB
)
DYNAMIC RESULT SETS 0
LANGUAGE SQL
BEGIN
INSERT INTO MSG_TABLE(MSG_ID, MSG_DATA)
VALUES (I_MSG_ID, I_MSG_DATA);
END

and xml

<named-stored-procedure-query
name="INSERT_MSG"
procedure-name="INSERT_MSG"
returns-result-set="false"
call-by-index="true">
<parameter
name="I_MSG_ID"
direction="IN"
query-parameter="I_MSG_ID"
type="Integer"
/>
<parameter
name="I_MSG_DATA"
direction="IN"
query-parameter="I_MSG_DATA"
type="byte[]"
/>
</named-stored-procedure-query>

java code:
Query q = em.createNamedQuery("INSERT_MSG");
q.setParameter("I_MSG_ID", msgId);
q.setParameter("I_MSG_DATA", msgData);
q.executeUpdate();

I got the DB2 SQLERROR

Input data type mismatch, see chained exceptions; will retry execution using describe input information.
Please change application to use an input data type that matches the database column type as required by JDBC semantics. ERRORCODE=4461, SQLSTATE=01000:01000 - com.ibm.db2.jcc.b.SqlException: DB2 SQL Error: SQLCODE=-301 ....

Though record can be inserted but how do I resolve this error message, do I need to tell Blob in parameter?

Thanks in advance.
Previous Topic:Enumerated(EnumType.String) annotation not working in 2.3.0
Next Topic:toNumber() expression with custom precision
Goto Forum:
  


Current Time: Wed Nov 26 04:12:43 GMT 2014

Powered by FUDForum. Page generated in 0.01717 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software