I need to establish a connection to MySQL DB. Using some examples from the Internet, I managed to have a simple JSP accessing the DB and displaying data on the browser.
Next, I developed a small servlet querying exactly the same table (copy-paste of the SELECT statement).
This time, the Servlet is being accessed (I can see titles deployed by the JSP) but the access to the DB fails with the following exception message:
SQLException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Again, within the same TOMCAT instance, JSP works while the Servlet doesn't.
Any clue? Could it be an issue of versions used in the Servlet development (Eclipse), and if so, how can I check which version is being used in the TOMCAT and which within Eclipse?
Thanks!!
As far as I can see, this is not a duplicate as suggested in the first comment. Please read the details of the problem before marking it as duplicate.