Performance and scalability: Optimum way of handling Database connections
- Posted by: Satish Sadasivam
- Posted on: September 27 2000 07:42 EDT
Please suggest me the optimum way of handling database connections. When should i go for connections in static variables and when for instance variables. Moreover, if in case the application abnormally terminates, how to trap the event and close all the connections opened by the application?.
Please help me.
In a Web or EJB environment should avoid static variables for anything but constants. The EJB or Webcontainter should provide database connections or transaction handles via jndi or something similiar.