Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-05-2008, 06:50 AM
Member
 
Join Date: Dec 2008
Location: Mexico
Posts: 10
Rep Power: 0
saul_2110 is on a distinguished road
Default Either ResultSet or a specific object?
Hello. I have this doubt... When querying a DB through JDBC, should I take the data directly from the ResultSet and into the GUI or should I create an object, fill that object with the data from the ResultSet and then use the object to fill the GUI.

Which would be the criteria to choose from one or the other approach?

Thanks a lot.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 12-05-2008, 08:00 AM
Senior Member
 
Join Date: Jun 2008
Posts: 902
Rep Power: 2
masijade is on a distinguished road
Default
A ResultSet should not live beyond the retrieval from the DB and all DB resources should be closed ASAP. Now, knowing this, which is better?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-05-2008, 09:15 PM
Member
 
Join Date: Dec 2008
Location: Mexico
Posts: 10
Rep Power: 0
saul_2110 is on a distinguished road
Default
Stated that (masijade's reply), I suppose copying the data from the ResultSet to a specific object (please correct me if I am wrong).

About closing all DB resourses ASAP after DB retrieval... does that include the Connection and Statement objects?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-06-2008, 07:41 AM
Senior Member
 
Join Date: Jun 2008
Posts: 902
Rep Power: 2
masijade is on a distinguished road
Default
The statement definately, and if you are using a pool, the connection as well.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i print a specific txt file on a specific printer nikhilbhat New To Java 2 11-08-2008 10:40 AM
Open specific folder form JSP roseline43 New To Java 2 09-02-2008 07:53 PM
Select specific cell Echilon New To Java 1 01-01-2008 07:47 AM
Rejecting connections from a specific IP javaplus Networking 2 12-21-2007 02:28 PM
How to cast an Object into a specific type (Integer/String) at runtime mailtogagan@gmail.com Advanced Java 2 12-03-2007 01:04 PM


All times are GMT +2. The time now is 12:06 AM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org