Results 1 to 4 of 4
  1. #1
    saul_2110 is offline Member
    Join Date
    Dec 2008
    Location
    Mexico
    Posts
    10
    Rep Power
    0

    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.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    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?

  3. #3
    saul_2110 is offline Member
    Join Date
    Dec 2008
    Location
    Mexico
    Posts
    10
    Rep Power
    0

    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?

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    The statement definately, and if you are using a pool, the connection as well.

Similar Threads

  1. Replies: 2
    Last Post: 11-08-2008, 11:40 AM
  2. Open specific folder form JSP
    By roseline43 in forum New To Java
    Replies: 2
    Last Post: 09-02-2008, 08:53 PM
  3. Select specific cell
    By Echilon in forum New To Java
    Replies: 1
    Last Post: 01-01-2008, 08:47 AM
  4. Rejecting connections from a specific IP
    By javaplus in forum Networking
    Replies: 2
    Last Post: 12-21-2007, 03:28 PM
  5. How to cast an Object into a specific type (Integer/String) at runtime
    By mailtogagan@gmail.com in forum Advanced Java
    Replies: 2
    Last Post: 12-03-2007, 02:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •