Results 1 to 2 of 2
  1. #1
    Albert is offline Senior Member
    Join Date
    Jun 2007
    Posts
    114
    Rep Power
    0

    Default Connections to data bases

    When we work with connections to data bases and do operations like select, we must generate the following objects:
    A Connection, a Statement and a ResultSet.
    When finalizing the query one must close the connection and the other objects.
    My question is the following one:
    the ResultSet object, it is created through Statement object, and this through Connection object, is it enough to close the Connection object?, that is to say, to do a Connection.close(), or is it necessary to close the three objects one by one?

    Albert:rolleyes:

  2. #2
    Eric is offline Senior Member
    Join Date
    Jun 2007
    Posts
    111
    Rep Power
    0

    Default

    You have that to close one by one.
    The method of the Connection object gives you an object Statement, and the object Statement gives you a Resultset, it does not mean that one “contains” to the others.
    They are objects that “live” in independent form, are in different zones from memory, etc, etc, etc.

    Eric

Similar Threads

  1. Export data to xls
    By trill in forum Advanced Java
    Replies: 5
    Last Post: 03-24-2011, 05:13 AM
  2. Replies: 0
    Last Post: 04-01-2008, 10:44 AM
  3. Rejecting connections from a specific IP
    By javaplus in forum Networking
    Replies: 2
    Last Post: 12-21-2007, 02:28 PM
  4. add data into an array
    By mispeed in forum New To Java
    Replies: 9
    Last Post: 11-08-2007, 03:53 AM
  5. Replies: 0
    Last Post: 10-04-2007, 09:15 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
  •