Where to store a DataSource resource in a Java web app?

Posted by Slavko on Stack Overflow See other posts from Stack Overflow or by Slavko
Published on 2010-05-11T21:41:59Z Indexed on 2010/05/11 21:44 UTC
Read the original article Hit count: 309

Filed under:
|
|
|

This is a rookie question. What's the best place to put

@Resource
private DataSource ds;

in a web application? Do I put it in a servlet, context listener or maybe there's a better place for it? Also, do I create a new Connection object in my doGet()/doPost() or should I do it somewhere else? What's the best practice for stuff like this? Thank you!

© Stack Overflow or respective owner

Related posts about java

Related posts about mvc