Use a Connection pool. Jakarta Commons has one that's comonly available and easily configured in Tomcat, Spring, in code, etc.
Make the Connection pool persistant (As it might be if it were available in a Spring context, for example.), and then on each new "request" (ie, if you're going to use it for a method block, or something) grab a connection and be sure to follow the heuristics for resource release and close the connection. -- Joshua Long Sun Certified Java Programmer http://www.joshlong.com/ On 5/13/07, Asaf Paris Mandoki <[EMAIL PROTECTED]> wrote:
Hello, I understand, form reading the Walking Tour of the Struts 2 MailReader Application that they use an object that is created when the application starts, and stays there forever, to manage the data source (XML). I'm planning to make an application that uses a MySQL Database. Should I have a persistent object with a persistent connection to the database or is it better to create the connection each time i use it? Thanks, Asaf --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]