I had the same problem, my code is below:
private Connection conn = DriverManager.getConnection(Constant.MYSQL_URL, Constant.MYSQL_USER, Constant.MYSQL_PASSWORD);
private Statement stmt = conn.createStatement();
I have not loaded the driver class, but it works locally, I can query the results from MySQL, however, it does not work when I deploy it to Tomcat, and the errors below occur:
No suitable driver found for jdbc:mysql://172.16.41.54:3306/eduCloud
so I loaded the driver class, as below, when I saw other answers posted:
Class.forName("com.mysql.jdbc.Driver");
It works now! I don't know why it works well locally, I need your help, thank you so much!