This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Eclipse Collections Categorically: Level up your programming game and have Donald Raab on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Common resultSet Function

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have Problem When I am making Common Function Of ResultSet.Actully I want To Call This Function From Different Function To get The Result Set. Like


But Problem Is that If i Will Get The Result Set Its Shwoing Nothing Beacuse i Have Close the Connection Here of databsase and Result set.If if Will Close The Resultset and database connection From The Calling Function Then I got Some more Issue that I have to setAttribut of Resulset On servlet and Get This On JSp So I can not Close the resultset On servlet If i Do like It then How Can i Close the database Connection And Result set Connection.Otherwise Lot of Resultset and database Connection Will Open.
 
Ranch Hand
Posts: 439
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
kumar ,

Instead of returning the ResultSet object ( not advisable ) , it is always preferred to return a bean of values obtained from the result set. I would suggest that after you get the result set object ( rs ) , you set up an array list of objects and populate the array with the rows obtained in this result set and then return this List of objects instead of returning the ResultSet.
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic