wood burning stoves 2.0*
The moose likes JDBC and the fly likes Error : [Microsoft][ODBC Driver Manager] Invalid cursor state Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

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

Prakash Vaidyanathan
Greenhorn

Joined: Oct 10, 2003
Posts: 8
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.


V.Prakash
Manish Malhotra
Greenhorn

Joined: Apr 05, 2003
Posts: 29
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

Joined: Jan 10, 2002
Posts: 60782
    
  65

This is more appropriate for the JDBC: JDBC forum, so I'm moving it there.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Error : [Microsoft][ODBC Driver Manager] Invalid cursor state
 
Similar Threads
Error when using while loop inside another while loop
Error on using tiles on JBoss 3.2
JDBC driver not found in JSP
ResultSet problem
Stuts forwarding does not work