That can happen if the code doesn't close()
DB resources such as Connection
, Statement
and ResultSet
properly in the finally
block after use, which is a pretty common starters mistake. The DB will then run out of those resources after some time. That can also happen if the code is acquiring the DB connection on webapp startup only and using the one and same for connection for the remnant of the webapp's lifetime instead of acquiring it at the moment the SQL query is to be executed. A DB resource which is kept open for too long will timeout sooner or later.
I would also look at exception handling in your code. You should surely have gotten a SQLException
whenever this problem occurs. It look like that the code is swallowing the SQLException
by an empty catch block or by a catch block which does nothing else than printing it to the server log (which you maybe never have read). The code should never continue the flow whenever an exception occurs but instead properly handle the exception by displaying an error page. This is also a common starters mistake.
All with all, you can find a basic kickoff example of the proper approach in this answer: Show JDBC ResultSet in HTML in JSP page using MVC and DAO pattern.
Note that this has nothing to do with "the JAR file not working". This makes at its own absolutely no sense.