Closing Statement and ResultSet Objects

Ads

 
 

Share on Google+Share on Google+

pradeep
Closing Statement and ResultSet Objects
0 Answer(s)      7 years ago
Posted in : Development process
I Friend.

i am getting the closing the objects problem.


i am using the business logic in jsp now.it is having the two or more statements objects and results set objects ,how to close the objects.My code is



selectQuery="select no_of_hours from timesheet_tbl where work_dt>=#"+start_date+"# and work_dt<=#" + end_date +"# and emplid="+emplid;
res2=st.executeQuery(selectQuery);
hours=0;
while(res2.next())
{
hours=hours+res2.getDouble(1);

}

//calculate the amount
selectQuery="select rate from consulting_tbl where client_id='"+client_id+"' and emplid="+emplid;
res=st2.executeQuery(selectQuery);
res.next();
rate=res.getDouble(1);





Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Closing Statement and ResultSet Objects - Development process
Closing Statement and ResultSet Objects  I Friend. i am getting the closing the objects problem. i am using the business logic in jsp now.it is having the two or more statements objects and results set objects ,how
ResultSet
ResultSet   What is a ResultSet
Advertisements
ResultSet
ResultSet  What is a ResultSet
ResultSet
database.how to do it using resultset or Resultsetmetadata.Can you please tell me what... = DriverManager.getConnection(url, userid, pass); Statement st = con.createStatement(); ResultSet rs = st.executeQuery
closing connections in finally block
closing connections in finally block  Hi, What will happen if I close connection before closing the resultset in the finally clock? e.g. finally... { ... conn.close(); rs.Close(); } If i do as above ... what will happen
multiple resultset in one resultset
multiple resultset in one resultset  how to retrive multiple resultsets in one resultset in java.? plz help
for statement
for statement  for(int i=0;i<5;i++); { system.out.println("The value of i is :"+i); } if i end for statement what will be the output   got the answer.. it displays only the last iteration that is "The value of i
resultset metadta
resultset metadta  import java.sql.Connection; import... Employee Details Using resultset metadata: "); Connection con = null...); try{ Statement st = con.createStatement
Closing the browser window
Closing the browser window  <BODY> <form> <input type=button value="Close Window" onClick="javascript:window.close();"> </form> <center> <font face="arial, helvetica" size="-2">Free
How to make a closing eyes, make a closing eyes, closing eyes
How to make a closing eyes       This is a funny example, It is great effort to make still eye to closing eye. You will learn here how is it made possible
JTable populate with resultset.
JTable populate with resultset.  How to diplay data of resultset...) JTable(Vector data, Vector columneNames) Here is a JTable populate with resultset...,address from user"; Statement statement = con.createStatement
Creating JDBC Statement object
; } Creating JDBC Statement Object JDBC Statement is an interface of java.sql.*; package. It is used for execution of SQL statements. It returns a ResultSet object. This result set object contains the result of the query. Statement
Moving Cursor within ResultSet
; // connection reference variable for getting // connection Statement statement = null; // Statement reference variable for query // Execution ResultSet...; } Moving Cursor Within ResultSet There are many methods are given to move
Objects
Objects       Objects In this section we are going to illustrate how the real life objects are the key to understand object-oriented technology Objects are the part of our day to day
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
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
The cursor in scrollable resultset
The cursor in scrollable resultset   How to move the cursor in scrollable resultset
Update a resultset programmatically
Update a resultset programmatically  How to update a resultset programmatically
Tracing unexpected closing of awindow... - JSP-Servlet
Tracing unexpected closing of awindow...  Hello friends, How can we track unexpectedly closing a window when a jsp project running with session concept. And this tracking should update the log in status in data base
Printing Values of Resultset to Html Table
:3306/test","root","root"); Statement st=con.createStatement(); ResultSet rs...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
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 In Java
row. ResultSet object is automatically closed if the Statement/PreparedStatement...ResultSet In Java In this section we will learn about the ResultSet in Java... that are mostly used in to get the value. ResultSet contains the data of a table after
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
Implicit objects
Implicit objects  What are the implicit objects
update statement in mysql
update statement in mysql  Update statement to update the existing... { Connection con = null Statement stmt = null; ResultSet rs = null; String conUrl = "jdbc:mysql://localhost:3306
Data objects
Data objects   hello,, What are data objects?   hii, Sequences, Views, clusters, Tables, index and cluster are called data objects for a database
How to stop window closing in "internalFrameClosing" event.
How to stop window closing in "internalFrameClosing" event.  In an internal frame listener in the internalFrameClosing event I want to ask the user... it but it is still there. Is there a way to abort the frame closing event so the user can go back
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
Java Objects
Java Objects  What are Data Transfer Objects and where are they used