I have some questions regarding how you maintain connection to the database when building web applications.
1.) What's the best practice to maintain connection to the database to get data from it?
Is it request-scope, session-scope, or application-scope?
2.) Currently I have a session-scope bean that maintains connections to the database. The problem is if I open the browser overnight and the came back in the morning, I get some CommunicationsLinkFailure exception. I think this is because the session has died. How should I handle this?
Thanks in advance for all the help.