+ ";create=false");\r
\r
conn.setAutoCommit(true);\r
+\r
+ Runtime.getRuntime().addShutdownHook(new Thread() {\r
+ @Override\r
+ public void run() {\r
+ shutdownDBServer();\r
+ }\r
+ });\r
}\r
return conn;\r
}\r
-\r
public StatDB() throws SQLException {\r
this.conn = getDBConnection();\r
}\r
st.close();\r
}\r
\r
- public void shutdownDBServer() {\r
+ private static synchronized final void shutdownDBServer() {\r
// ## DATABASE SHUTDOWN SECTION ##\r
/***\r
* In embedded mode, an application should shut down Derby. Shutdown\r
dispatcher.forward(req, resp);\r
\r
} catch (SQLException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
+ throw new ServletException(e);\r
}\r
}\r
\r
req.setAttribute("statTotalLocal",\r
Totals.sumStats(stats.getLocalStat()));\r
\r
- req.setAttribute("startDate", fromDate.getTime());\r
- req.setAttribute("stopDate", toCal.getTime().getTime());\r
+ req.setAttribute("startDate", fromDate);\r
+ req.setAttribute("stopDate", toCal.getTime());\r
System.out.println(fromDate + " " + toCal.getTime());\r
RequestDispatcher dispatcher = req\r
.getRequestDispatcher("statpages/Statistics.jsp");\r
dispatcher.forward(req, resp);\r
\r
} catch (SQLException e) {\r
- // TODO Auto-generated catch block\r
e.printStackTrace();\r
+ throw new ServletException(e);\r
}\r
\r
}\r
} catch (SQLException e) {\r
e.printStackTrace();\r
throw new ServletException("SQLException : "\r
- + e.getLocalizedMessage());\r
+ + e.getLocalizedMessage(), e);\r
}\r
\r
}\r