Remarks
The most interesting feature of this class is that it implements HttpSessionBindingListener.
The event-handling method valueBound() is invoked whenever this object is bound to a session using setAttribute().
The method valueUnbound() is invoked whenever this object is unbound from a session, either by removeAttribute() or (more importantly) when the session is invalidated (e.g. when it times out).
This ensures that the database connection is closed promptly (and not left to the garbage collector).
The class also illustrates use of a static initialization clause.