Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Posts
    3

    Question Unanswered: DB2ConnectionPoolDataSource problem

    Good day to all,

    i am new to db2 Connection pooling.
    i had connected to DB2ConnectionPoolDataSource and got PooledConnection from the data source. my problem is how do i return the connection to the pool? do i have to use con.close()? if not how?

    I did con.close() but the problem is when i get the connection to the pool and created a statement it tells me an error that the connection is closed already.

    how do i resolve this?

    tnx in adv!!

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by s2iWi2s
    I did con.close() but the problem is when i get the connection to the pool and created a statement it tells me an error that the connection is closed already.
    So you're creating a statement after closing the connection? Try doing it before.

  3. #3
    Join Date
    Jan 2005
    Posts
    3
    what i did is that i used con.close() so that i would return the connection to the pool. i dont know if con.close() would mean 'closing the connection' or 'return the connection to the pool'. if it means 'closing the connection' how do i 'return the connection to the pool'. i used the classes in IBM COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource(IBM) & jdbc 2.0 javax.sql.PooledConnection.
    Last edited by s2iWi2s; 01-27-05 at 19:28.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by s2iWi2s
    i dont know if con.close() would mean 'closing the connection' or 'return the connection to the pool'.
    You don't need to worry about this. Just follow the rules: when you need a connection, do getConnection(); when you're done with it, do close(); after you've close()-ed a connection, you can't use the same instance of Connection again, get another one.

Posting Permissions

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