Bookmark Topic Watch Topic
  • New Topic

Error : [Microsoft][ODBC Driver Manager] Invalid cursor state

 
Prakash Vaidyanathan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am having one role combo with some roles.I also have a list box with a list of associates. Based on the role i have selected i need to select the associates already having that role from list box.
for that i have written the following code.
<%
if(rs!=null)
{
while(rs.next())
{
rs1 = st.executeQuery("select associate_id from project_associate where project_id = " + proj + " and role_id = " +role);
if(rs1!=null)
{
while(rs1!=null)
{
if(rs1.getInt("associate_id") == rs.getInt("associate_id"))
{
%>
<option value="<%=rs.getInt("associate_id")%>" selected><%=rs.getString("associate_fullname")%></option>
<%
}
else
{
%>
<option value="<%=rs.getInt("associate_id")%>"><%=rs.getString("associate_fullname")%></option>
<%
}
}
}
%>
<%
}
if(rs1!=null)
{
rs1.close();
rs1 = null;
}
}
%>
</select>
But when i use one while loop inside another while loop i am getting the following error
org.apache.jasper.JasperException: [Microsoft][ODBC Driver Manager] Invalid cursor state
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:534)
Can some one help me out.
 
Manish Malhotra
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is wat u hav posted.
--------------------------------------------------------------------------------
I am having one role combo with some roles.I also have a list box with a list of associates. Based on the role i have selected i need to select the associates already having that role from list box.
for that i have written the following code.
<%
if(rs!=null)
{
while(rs.next())
{
rs1 = st.executeQuery("select associate_id from project_associate where project_id = " + proj + " and role_id = " +role);
if(rs1!=null)
{
while(rs1!=null)
{
if(rs1.getInt("associate_id") == rs.getInt("associate_id"))
{
%>
<option value="<%=rs.getInt("associate_id")%>" selected><%=rs.getString("associate_fullname")%></option>
<%
}
else
{
%>
<option value="<%=rs.getInt("associate_id")%>"><%=rs.getString("associate_fullname")%></option>
<%
}
}
}
%>
<%
}
if(rs1!=null)
{
rs1.close();
rs1 = null;
}
}
%>
</select>

------------------------------------
You code the 2nd while loop as.
while(rs1!=null) but it should be
while(rs1.next())...
That is the problem.
change & then try to execute.
regards,
Manish Malhotra
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64994
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is more appropriate for the JDBC: JDBC forum, so I'm moving it there.
bear
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
This question had already been addressed here so I am closing this thread.
Please do not ask the same question in multiple Forums as it only makes it harder for us to help you.
 
    Bookmark Topic Watch Topic
  • New Topic