How to properly keep a DB connection from a Connection Pool opened in JBoss

后端 未结 2 1713
[愿得一人]
[愿得一人] 2020-12-21 19:03

I\'m using JBoss AS 7.1 as a server and I have my DataSource configured with pooling. I\'m quite new to this so please excuse any rookie mistakes... after all I\'m here to l

2条回答
  •  天涯浪人
    2020-12-21 19:55

    Your DBA is basically requiring you to avoid connection pooling by making the database connection equivalent to the user's session.

    So one option is to not use the connection pool, and instead roll your own functionality that opens/closes the database connection around the user's session. That seems complicated and unusual though.

    Another option is to examine the DBA's requirement. The DBA may have to adapt to the idea that he'll need to track state in a different way, e.g. by using a key related to the session to store the state he needs in a table, instead of storing state in the connection layer.

    Generally speaking storing state in some component's session handling is adding indirect complexity, because you start having to care about how the component handles expiry and uniqueness, as you're finding here where the HTTP session state handles this differently from the database session.

提交回复
热议问题