Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in rs

 
amit bhadre
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • 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("jdbcdbc: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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the JDBC forum.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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 ]
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic