Logging and Database Connection Pooling

Another thing you're going to spend much of your time doing in this project is opening and closing database connections. If you were doing this using J2EE, you would have connection-pooling mechanisms available automatically. But because you are working in pure JSP, you have to manage the connections yourself.

Now, one way to handle this is to have each usage of the database open and close a connection explicitly. A number of problems are associated with this approach, however. For one thing, this would require every class that talked to the database to have enough information available to establish a connection. Also, opening and closing database connections are just about the most expensive thing an application ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.