Results 1 to 10 of 10

Thread: Why we have to close connection, statement, prepared statement

  1. #1
    Geek_Guest
    Guest

    Why we have to close connection, statement, prepared statement

    Why we have to close connection, statement, prepared statement, What will happen if we dont close staement and prepared statement

    Question asked by visitor sreedhar


  2. #2

    Re: Why we have to close connection, statement, prepared statement

    then only trafic conjuction will be avoided


  3. #3
    Junior Member
    Join Date
    May 2007
    Answers
    15

    Re: Why we have to close connection, statement, prepared statement

    for security reasons


  4. #4
    Junior Member
    Join Date
    Jun 2007
    Answers
    7

    Smile Re: Why we have to close connection, statement, prepared statement

    once we aquire the result.we no more need the connection.So inorder to improve safety of u r application and performance u need to close the connection.


  5. #5
    Junior Member
    Join Date
    Jun 2007
    Answers
    21

    Re: Why we have to close connection, statement, prepared statement

    Without close connection, it may be affect another object.
    so we need close connection/stmt/pmst.

    share if another reason


  6. #6
    Junior Member
    Join Date
    Jul 2007
    Answers
    4

    Re: Why we have to close connection, statement, prepared statement

    not closing connections to DB server will soon result in no managed connections available exception i.e. other threads/programs needing to use connections will not find any as all connections are already in use (not closed)


  7. #7
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Why we have to close connection, statement, prepared statement

    For beter managemnet of objects. again it is always recommended to close the connection for security reason.


  8. #8
    Junior Member
    Join Date
    Jan 2007
    Answers
    22

    Re: Why we have to close connection, statement, prepared statement

    having connections open is like programmer sitting on beach(doing nothing) now wud that not be a waste of resource?


  9. #9

    Re: Why we have to close connection, statement, prepared statement

    Hi ,
    Holding any ref. un-necessary will impact on system.
    When you claose connection etc. , its available for Garbage Collection.


  10. #10
    Junior Member
    Join Date
    Nov 2006
    Answers
    1

    Re: Why we have to close connection, statement, prepared statement

    As per my understanding:

    while a connection object is created, it locks the database. related to that connection object. when the developer does not close the connection, the lock to the database will not be released. so no other thread can access the database.
    when a statement object is created, it locks the table.
    same as when resultset object is created, it locks the row.

    when these objects are not closed after use, these locks will never ve released. hence reduces the performance.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact