File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes java.sql.SQLException: Ref cursor is invalid Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: Ref cursor is invalid" Watch "java.sql.SQLException: Ref cursor is invalid" New topic
Author

java.sql.SQLException: Ref cursor is invalid

sunil ch
Greenhorn

Joined: Jul 05, 2005
Posts: 1
Hi all,

please help in this error.

cst = conx.prepareCall("call OFFNAMES_READ(?,?,?,?)");

cst.registerOutParameter(2, oracle.jdbc.driver.OracleTypes.CURSOR);
cst.registerOutParameter(3, java.sql.Types.INTEGER);
cst.registerOutParameter(4, java.sql.Types.INTEGER);
cst.setInt(1, officeCod);
cst.execute();

hash = new HashMap();
both = new ArrayList();
int officeCode = 0;
String officeName = null;
String officeType = null;
if(cst.getObject(2)!=null){
Object officeInfoRes = cst.getObject(2);

here htis problem is getting


ava.sql.SQLException: Ref cursor is invalid
19:06:56,670 ERROR [STDERR] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
19:06:56,670 ERROR [STDERR] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
19:06:56,670 ERROR [STDERR] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
19:06:56,670 ERROR [STDERR] at oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:3847)
19:06:56,670 ERROR [STDERR] at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:6039)
19:06:56,670 ERROR [STDERR] at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:5827)
19:06:56,670 ERROR [STDERR] at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:698)
19:06:56,670 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedCallableStatement.getObject(WrappedCallableStatement.java:68)
19:06:56,670 ERROR [STDERR] at com.xius.common.StockFunDB.getAllNames(StockFunDB.java:902)
19:06:56,670 ERROR [STDERR] at com.xiusbcgi.ui.struts.action.dealercare.StockSAction.reportMain(StockSAction.java:191)
19:06:56,670 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
19:06:56,670 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
19:06:56,670 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
19:06:56,670 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
19:06:56,670 ERROR [STDERR] at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
19:06:56,670 ERROR [STDERR] at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
19:06:56,670 ERROR [STDERR] at com.xiusbcgi.ui.struts.action.VoyagerDispatchAction.execute(VoyagerDispatchAction.java:152)
19:06:56,670 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
19:06:56,670 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
19:06:56,670 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
19:06:56,670 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
19:06:56,670 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
19:06:56,670 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:06:56,670 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
19:06:56,670 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
19:06:56,670 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
19:06:56,670 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
19:06:56,670 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
19:06:56,670 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
19:06:56,670 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
19:06:56,670 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
19:06:56,670 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
Sudheer Bhat
Ranch Hand

Joined: Feb 22, 2011
Posts: 75
Do you return a valid ref cursor? If the ref cursor is not opened, then you will hit this error. Not enough information on the plsql routine, so I am just guessing.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException: Ref cursor is invalid