4 Replies Latest reply on Jul 8, 2003 5:05 AM by imcshane

    Using JDBC from within a Resource Adapter - some questions

    imcshane Newbie


      I've written a resource adapter and have successfully been using it with various JBoss 3.0.x versions for quite a while now. At the moment I'm using 3.0.7 (with tomcat).

      Recently I've added some JDBC to my managed connections. I'm accessing the database via a ConnectionFactory for a postgres db.

      This has caused problems because I get the following error message when "cleanup()" is called on my managed connection:
      "Successfully closed a connection for you. Please close them yourself:"
      The message is referring to my JDBC connection handle stored in my managed connection.

      Why is it necessary to close jdbc connection handles at this point ? I can understand it being necessary to force the connection closure for a destroy() but am unsure of the reasons for doing it on a cleanup().

      I was hoping that I could keep connection handles open for the lifecycle of my own ManagedConnections as I wish to optimise database access by reusing PreparedStatements.

      Would using standard JDBC rather than accessing connections via the Application Server's connection factory resolve this problem ?

      Is it good or bad practice to access a connection factory from within another Connector ?