1

I'm looking forward to reduce the initialization time of MySQL when working on servlets. It looks like this is a hard thing to do, so I need a better solution.

Is there any preloaded way to solve this? Something like a pool or whatever? (I don't know what I'm talking about).

SCENARIO User sets login parameters. Press Login button. MySQL initializes (5 secs!!). Still loads... User thinks service is not working. User closes tabs.

3
  • I was trying to suggest solutions, as I'm short on ideas this time. Thanks for your answer.
    – John
    Aug 16, 2017 at 0:04
  • @ScaryWombat Indeed this is exactly what I am looking! Thank you very much, again.
    – John
    Aug 16, 2017 at 0:08
  • Your servlet container (Tomcat, Glassfish, whatever) ought to have some kind of DB connection pool you can use. You definitely don't want to be doing your own jdbc / jndi Naming.lookup() and bringing connections up and down all over the place.
    – Stephen P
    Aug 16, 2017 at 0:10

1 Answer 1

3

To reduce connection time in a servlet, usually a database conenction pool is used. This will take care of initializing connections and allocating them for you.

see https://commons.apache.org/proper/commons-dbcp/

for an example jar

Not the answer you're looking for? Browse other questions tagged or ask your own question.