Meaningless Drivel is fun!*
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 Murach's Java Servlets and JSP this week in the Servlets 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.


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java.sql.SQLException: Ref cursor is invalid
 
Similar Threads
java.lang.ClassCastException
Error Calling stored procedure from my java codes.
how to make java database connectivity with oracle 10g on windows vista operating system.
SQLException throws after changing C3P0 configuration
using jdbc thin driver of oracle 10XE