SQL exception, Exhausted ResultSet

SQL exception, Exhausted ResultSet

javax.servlet.ServletException: java.sql.SQLException: Exhausted Resultset

iam getting this error messege whenever i run my code. what would be the possible reasons??

View Answers

May 9, 2013 at 10:19 PM

how can i destroy a resultset object explicitly?


May 22, 2013 at 1:27 PM

hi friend,

java.sql.SQLException: Exhausted ResultSet exception may be thrown when you would be tried to access the column value after processing the ResultSet i.e. the result set is closed. For example if you tried to access the column value like the code given below then this exception may be thrown.

ps = con.prepareStatement(sql);
rs = ps.executeQuery();         
 while(rs.next())
  {
    name = rs.getString(1);
  }
  name = rs.getString(2);

Thanks.









Related Tutorials/Questions & Answers:
SQL exception, Exhausted ResultSet
SQL exception, Exhausted ResultSet  javax.servlet.ServletException: java.sql.SQLException: Exhausted Resultset iam getting this error messege whenever i run my code. what would be the possible reasons
Resultset Issue in SQL
Resultset Issue in SQL  when i call rs.next() in my code it is returning false, though im having valid query to execute and fetch a row from database.how can i resolve this issue. My code is: SELECT JOBDESCRIPTION,CATEGORY
Advertisements
large resultset values - SQL
large resultset values  i have one query which will bring more than one lakh records from database(total records are abt 3 crores). While getting the details i'm getting error like
SQL Exception
SQL Exception  I want stores data in to the databse table but it can't be stores it shows an error about sql exception. blackberry.html <...(Exception e) { out.println("Failed to success
Java sql Exception
Java sql Exception  difference between sql exception class and sql warning class
sql exception - JSP-Servlet
sql exception  Dear sir , I am working in a web-based project, In my system it is working fine but at client side getting the following exception so how to resolve this help me... java.sql.SQLException: ORA-28231
Executing anonymous pl/sql block and get resultset in Java
Executing anonymous pl/sql block and get resultset in Java  Hello All, I would like to execute the anonymous pl sql block and need to get the resultset object. I got the code which can be done by using cursors inside the pl sql
jdbc sql exception.
jdbc sql exception.  import java.sql.*; import java.io.*; class InsertEx { public static void main(String args[])throws Exception { Class.forName... Employee salary 9000 Enter Employee address hyd Exception in thread "main
ResultSet
ResultSet   What is a ResultSet
Enhanced SQL Exception Handling
Enhanced SQL Exception Handling       5. Enhanced SQL Exception Handling: A lot of improvement has been done regarding Exception handling in the following fields: Iterable SQL Exception
ResultSet
ResultSet  What is a ResultSet
jdbc odbc sql server exception
jdbc odbc sql server exception  Hi, I am trying to use sql server with java jdbc odbc but I am getting this exception java.sql.SQLException: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '@P1
ResultSet
database.how to do it using resultset or Resultsetmetadata.Can you please tell me what... = con.createStatement(); ResultSet rs = st.executeQuery...----------------------); } } catch (Exception e
This Query is no working in sql developer it is giving Ora-0933 exception SQL command not properly ended exception
This Query is no working in sql developer it is giving Ora-0933 exception SQL command not properly ended exception  SELECT * from employees ORDER BY first_name limit 0,10;   Hi Friend, Please clarify your problem!ADS
multiple resultset in one resultset
multiple resultset in one resultset  how to retrive multiple resultsets in one resultset in java.? plz help
Get Column Count using ResultSet in SQL
Get Column Count using ResultSet in SQL   ... of columns in a ResultSet. The ResultSetMetaData object can be obtained by invoking getMetaData() method on ResultSet object. In this program you will see how JDBC
resultset metadta
resultset metadta  import java.sql.Connection; import... Employee Details Using resultset metadata: "); Connection con = null...(); ResultSet rs = st.executeQuery("SELECT * FROM employee
exception
exception  Identify the reason for SQLException exception, which... (?,?)"; PreparedStatement ps = con.prepareStatement(str); ResultSet rs=ps.createResultset..."); ps.executeUpdate(); } catch(Exception e
exception
exception  wHEN RUNTIME EXCEPTION CLASS IS SUB OF EXCEPTION CLASS HOW CAN'T HANDLE UNCHECKED EXCEPTION
exception
exception  chek in and check out exception in java   Please visit the following link: Checked and Unchecked Exception
exception
arguments are not equalto two,throw a user defined exception "invalid parameter exception" ,otherwise display the two parameters.   Here is an example... is not equal to two then invalid parameter exception is thrown ,otherwise display the two
exception
exception  what is the use of catch block even though we have predefined exception object
exception
exception  example for numberformat exception   Hi Friend, Try the following code:ADS_TO_REPLACE_1 class NumberFormatExceptionEx...); } catch(Exception e){ System.out.println(e
exception
defined checked exception ââ?¬Å?InvalidCharcterFoundExceptionââ?¬Â? and creater a block of codes that will handle the exception
Exception
Exception  whis is the Arithmetic Exception in java? or define Arithmetic Exception with exp?   Arithmetic Exception occurs, when you divide a number by zero. Example public class TryCatch { public static void main
Exception
Exception  public class FooException extends Exception { public..."); } public void calculate() throws FooException, Exception { try { int.... ex.printStackTrace(); System.exit(1); } catch(Exception ex
Exception
Exception   I was creating a table dynamically but it shows exception i.e shown down Suplier created0 Suplier created0 Suplier created0 Product created0 Product created0 Product created0 Product created0 could not fetch initial
exception
user defined unchecked exception  can we create user defined unchecked exceptions? if so what is the exact use of it in real time?   Please visit the following links: http://www.roseindia.net/java/java-exception/user
JTable populate with resultset.
(); ResultSet resultSet = statement.executeQuery(sql...JTable populate with resultset.  How to diplay data of resultset...) JTable(Vector data, Vector columneNames) Here is a JTable populate with resultset
resultset problem - JSP-Servlet
resultset problem  hi I have one problem with resultset? ResultSet rs=st.execute("select subjname,staffname from staffdetails"); while... is java.sql.SQLException: Operation not allowed after ResultSet closed how
Update a resultset programmatically
Update a resultset programmatically  How to update a resultset programmatically
The cursor in scrollable resultset
The cursor in scrollable resultset   How to move the cursor in scrollable resultset
JDBC4.0-SQL Exception Handling Enhancements
categories of SQLException introduced in JDBC 4.0: SQL non-transient exception SQL transient exception Non-Transient Exception: This exception is thrown when...JDBC4.0-SQL Exception Handling Enhancements Exception handling is an important
ResultSet In Java
executing the SQL queries. Object of ResultSet also maintains the current position...; ResultSet rs = null; String sql = "SELECT * FROM attendance"; public void...ResultSet In Java In this section we will learn about the ResultSet in Java
Printing Values of Resultset to Html Table
Printing Values of Resultset to Html Table  I have a resultset and I need to collect the resultset values into the arraylist into a table... in advance   JSP Display values of ResultSet to HTML table: <%@page
Resultset - JSP-Servlet
Resultset  I am writing while(rs.next){} but if resultset is null then it cannot enter in while block. I want,if resultset is null then it will enter into the while block.  Hi friend, A ResultSet object
Resultset with one to many relationship
Resultset with one to many relationship   Suppose there are 5 tables in database named A,B,C,D and E. A has one to many relationship with B,C,D and D... populate my bean classes from resultset without using hibernate, so
JSP - Resultset - JSP-Servlet
JSP - Resultset  hello sir, how can i count record in jsp. i use resultset in my jsp so in my login form how can i check the username and password is correct or not...?? please reply it's urgent.. thanks
sql
difference between sql and oracle  what is the difference between sql and oracle
sql
sql  how to get first row in sql with using where condition in sql? how to get last row in sql with using where condition in sql
receive a ResultSet from a stored procedure
receive a ResultSet from a stored procedure  How do I receive a ResultSet from a stored procedure
Spring JdbcTemplate and ResultSet is too slow..
Spring JdbcTemplate and ResultSet is too slow..  Hi.. I am using spring jdbctemplate to fetch the records from oracle database. But it is taking... am using java jdbcTemplate.query(sql, params, RowMapper object) and each record
sql - SQL
("SQL statement is not executed!"); } } catch (Exception e...sql functions with examples  I need sql functions with examples... userid where empname='amardeep'"; ResultSet rs = st.executeQuery(query
sql
sql  I want interview sql questions   Please visit the following link: SQL Tutorials
ResultSet object initialization - Java Beginners
ResultSet object initialization  How to initialize resultset object  Hi friend, public interface ResultSet A ResultSet object maintains a cursor pointing to its current row of data. A default ResultSet object
JDBC ResultSet first() Example
JDBC ResultSet first() Example: The ResultSet first() are use to moves the cursor to the first row in the ResultSet object. It return true if the cursor pointed first row in the ResultSet and return false if the ResultSet object does
JDBC ResultSet last() Example
JDBC ResultSet last() Example: The ResultSet last() are use to moves the cursor to the last row in the ResultSet object. It return true if the cursor pointed last row in the ResultSet and return false if the ResultSet object does
Sql
Sql  how to find maximum of a101,a102,a103 from a table in sql
Exception in thread "main" java.lang.ClassCastException
Exception in thread "main" java.lang.ClassCastException  I am trying to connect the database. I am stuck with this exception that is getting thrown...*; public class Test_jdbc { public Test_jdbc() { } // executes single SQL query
Exception in thread "main" java.lang.ClassCastException
Exception in thread "main" java.lang.ClassCastException  I am trying to connect the database. I am stuck with this exception that is getting thrown...; public class Testjdbc { public Testjdbc() { } // executes single SQL query public

Ads