Hi punnet,
Thanks for your prompt reply.
Actually I am not closing that cursor in java code. Cursor is not opened in stored procedure
for example if you have following oracle procedure

create or replace PROCEDURE SAMPLE_PROC (id IN NUMBER ,                                                                
                                  output IN OUT SAMPLE$PACK.SAMPLE_CUR,
                                  err OUT VARCHAR2)
IS 
BEGIN  
 OPEN output FOR SELECT ID,
                     NAME
                 FROM   MOCK_TABLE ;                
END;

and Because of some IF condition that (output )cursor is not fetched then you will get the following exception
in your plain JDBC code also.
In SqlExecutor.java the JDBC code to retrieve Cursor (cs.getObject(i+1)) is causing the exception
So for a time being we catched that exception to retrieve other output parameters. Is there any other way to avoid this exception

Regards,
Vishakha sawant







On 07/07/06, puneet arya <[EMAIL PROTECTED] > wrote:
where you are closing the cursor remove that line . might be it works.

Regards,
Puneet Arya


vishakha sawant < [EMAIL PROTECTED]> wrote:
Hi,
I am using a patch version iBatis for REF CURSOR. We are using legacy database
I was getting exception "Cursor is closed" while executing a procedure.

stack trace of that exception is
java.sql.SQLException : Cursor is closed.
    at oracle.jdbc.driver.T4CResultSetAccessor.getCursor (T4CResultSetAccessor.java:271)
    at oracle.jdbc.driver.ResultSetAccessor.getObject(ResultSetAccessor.java:94)
    at oracle.jdbc.driver.OracleCallableStatement.getObject (OracleCallableStatement.java:1368)
    at test.TestSPA.main(TestSPA.java:95)

After doing some R&D I found that the if cursor is 'OUT' parameter and that is not opened in procedure, it will result in this exception. According to stack trace I found that in retrieveOutputParameters() method of  com.ibatis.sqlmap.engine.execution.SqlExecutor.java  cs.getObject(i+1)  is causing this exception. For a time being we are catching that exception so that we can retrieve other OUT values from procedure. Is there any other way to resolve this issue?
It's urgent.

Regards,

Vishakha sawant



Find out what India is talking about on Yahoo! Answers India.
So, what's NEW about the NEW Yahoo! Messenger? Find out.


Reply via email to