This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hi, i have a database class which does all my database operations. I am using connection pooling. One of my function is executequery which takes in the SQL query as a parameter and retuns the Resultset. Now the problem is that i am able to release the connection but i am not able to close the statment object. If I close the statement object my result set also goes. Is there any way to solve this, or my approach of returning the resultset is wrong ??? TIA Anil
Although this topic is different, I posted 2 different ways to handle your situation at http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=3&t=001893 The first is returning an array list instead of a resultset. The second is create the statement/resultset at the class level. You then pass the resultset from your method, use it, then when you are done with it, have a method in which you can close the resultset/statement. See the above link for more details. Jamie
Joined: Nov 04, 2000
Thanks Jamie But i am using the connection pooling and i am able to release the connection. But cant close the statement. if i close the statement, i am not bale to access the resultSet. Here is how my code for the database class looks looks.
Is this a problem in design ??? this code works fine but as i am not closing the statement, will it have performance issues ??? TIA Anil