• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Error in rs

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code is ...


<%@ page language="java" import="java.sql.*,java.io.*,java.util.*"%>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:CMS2.0","sa","sa");
Statement stmt=con.createStatement();
Statement stmt1=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from CMS_CANDIDATE_HISTORY_NOTES");
ResultSet rs1=stmt1.executeQuery("select Name from CMS_EMPLOYEE");
%>
<HTML>
<HEAD>
<H3 align=center>
<U>
THE HISTORY RECORDS
</U>
</H3>
</HEAD>
<BODY>
<table align=center>
<SELECT NAME="Select Employee" value="Qatalys Employee">
<option selected>Employee Select</option>
<%try{ while(rs1.next()){%>
<option><%= rs1.getString("Name") %></option>
<%}%>
</SELECT>
<INPUT TYPE="submit" VALUE="SUBMIT">
</table>
<p>
<p>
<HR>
<p>
<p>
<table width=30% ALIGN=CENTER>
<tr>
<td>
<TEXTAREA NAME="History" ROWS="3" COLS="70">Notes</TEXTAREA>
</td>
<td>
<INPUT TYPE="submit" value="Submit">
</td>
<td>
<INPUT TYPE="reset" value="Cancel">
</td>
</tr>
</table>
<HR>
<table width=100% align=center border=2>
<tr>
<td width=20%>Sl No<td>
<td width=20%>Created User</td>
<td width=20%>Remarks</td>
<td width=20%>Notes</td>
<td width=20%>Date</td>
</tr>
<% while(rs.next()){ %>
<tr>
<td><%= rs.getString("cand_history_id") %></td>
<td><%= rs.getString("cand_id")%> </td>
<td><%= rs.getString("user_name")%>
<td><%= rs.getString("recruiter_notes")%></td>
<td><%= rs.getString("manager_notes")%></td>
<td><%= rs.getString("last_modified")%></td>
</tr>
<% }}catch(Exception e){out.println(e);}%>
</table>
</BODY>
</HTML>

Error is
javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.jsp.general.History_jsp._jspService(History_jsp.java:138)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856


I tried with closing in while loop but not closed.

How to do so?
thanks in advance.
 
Sheriff
Posts: 67619
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the JDBC forum.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whyare you using the JDBC-ODBC bridge? Could you not use jTDS or the Microsoft driver?
[ June 08, 2006: Message edited by: Paul Sturrock ]
 
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Statement stmt=con.createStatement();
Statement stmt1=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from CMS_CANDIDATE_HISTORY_NOTES");
ResultSet rs1=stmt1.executeQuery("select Name from CMS_EMPLOYEE");


Change the order of the statements and try...


Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from CMS_CANDIDATE_HISTORY_NOTES");
Statement stmt1=con.createStatement();
ResultSet rs1=stmt1.executeQuery("select Name from CMS_EMPLOYEE");

Regards
reply
    Bookmark Topic Watch Topic
  • New Topic