aspose file tools*
The moose likes JDBC and the fly likes Error in rs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error in rs" Watch "Error in rs" New topic
Author

Error in rs

amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
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.


Thanks advance who ever answers this question.


regards
amit bhadre
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

Moved to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Whyare you using the JDBC-ODBC bridge? Could you not use jTDS or the Microsoft driver?
[ June 08, 2006: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in rs