hiii, I'm sri latha am getting an error like "null java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state" for the following code which is written in jsp, plz help me to get out of it


<%@ page import = "java.sql.*" %>
<%!
String Url = "jdbcdbc:OnlineShopping";
Connection db = null;
Statement DataRequest = null;
ResultSet result1 = null, result2 = null;
String cate = null, res = null,query1 = null,query2 = null,bid,bn,au;

int pr,ca,nb;
%>
<%
//cate = (String)Session.getValue("id");

//cate1 = Integer.parseInt(cate);

try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
db = DriverManager.getConnection(Url,"scott","tiger");
DataRequest = db.createStatement();
out.println(cate);
query1 = "SELECT CategoryId from Category where category='"+cate+"'";
result1 = DataRequest.executeQuery(query1);
res = result1.getString("CategoryId");
out.println("hi:");
out.println(result1.getString(1));
query2 = "SELECT BookId, Bname, Author, Price, CategoryId, NOB from Book where CategoryId='"+res+"'";
result2=DataRequest.executeQuery(query2);

out.println("<br><br><br><center><table border=2 bordercolor=black bgcolor=#F0F0F0 align=center width=400 height=150><tr><th align=center>BOOKID</th></tr><tr><th align=center>BOOK NAME</th></tr><tr><th align=center>AUTHOR</th></tr><tr><th align=center>PRICE</th></tr><tr><th align=center>CATEGORY ID</th></tr><tr><th align=center>NO.OF BOOKS</th></tr></center>");

while(result2.next())
{
bid = result2.getString("BookId");
bn = result2.getString("Bname");
au = result2.getString("Author");
pr = result2.getInt("Price");
ca = result2.getInt("CategoryId");
nb = result2.getInt("NOB");
out.println("<tr><td align=center>"+bid+"</td><td align=center>"+bn+"</td><td align=center>"+au+"</td><td align=center>"+pr+"</td><td align=center>"+ca+"</td><td align=center>"+nb+"</td></tr>");
}
out.println("</table>");
}
catch(Exception e)
{
out.println(e);
}

%>