/** * Creates a db connecton. * * @return true if OK, false if there's a problem */ private boolean createDbConnection( HttpSession session, HttpServletRequest req, HttpServletResponse res) throws Exception { // At this point a driver and connection may already be set // up. So here it first tests if a connection can be made. // If not, set params up, and test the setup. if (ConnManager.getConn() == null) { ConnManager.getInstance() .setLoginParams( session.getAttribute("dbtDbDriver"), session.getAttribute("dbtDbUrl"), session.getAttribute("dbtDbUser"), session.getAttribute("dbtDbPassword")); if (ConnManager.getConn() == null) { Util.putMessagePage(res, "Cannot login to DBT database"); // Invalidates the session in case connection is "stuck" in error session.invalidate(); return false; } } return true; }