May be i am wrong to post this question here.. if it is then my aplogoies..
What i am trying to do is to retrieve the data from two different result set and then presenting them in a dropdown combo box in HTML. And i am using netbeans 5.5 but i am getting : "Result set is closed." Why this is happening ? How am i supposed to achieve what i am trying to do here ?
<body> <% Connection con=null; String newname; String arr_gen_name[] = null; String arr_class_name[] = null; int i = 0; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:orcl","scott","tiger"); ResultSet rs1 = null; ResultSet rs2 = null; Statement s1 = con.createStatement(); rs1 = s1.executeQuery("SELECT GEN_NAME FROM GEN_CLASS"); rs2 = s1.executeQuery("SELECT DISTINCT CLASS_NAME FROM GEN_CLASS"); while(rs1.next()) { arr_gen_name[i] = rs1.getString("GEN_NAME"); System.out.println(arr_gen_name[i]); i++; } i=0; while(rs2.next()){ arr_class_name[i] = rs2.getString("CLASS_NAME"); i++; } i = 0; %> <form action="insertdata.jsp" method="post"> <table style="position:absolute; left:480px; top:150px;"> <tr> <td style="padding-right:20px; padding-bottom:25px; font-size:20px; font-family:Arial Rounded MT Bold;">Enter Generic Name </td> <td style=" padding-bottom:25px; "><input type="text" name="gen_text" id="gen_text" /></td> <td> <select name="gen_name_sel"> <% while(i < arr_gen_name.length) { %> <option><%=arr_gen_name[i]%></option> <% i++; } i = 0; %> </select> </td> </tr>
Thanks in advance