I've got a servlet and a filter connected to it. In this filter I'd like to do some database things but I've got well known error "No suitable driver found for jdbc:mysql". I've been using the jdbc in the past and those codes still work. But when I copy the connection lines from them to my filter, I've got the error. I change the database name in the line.
Here's my filte:
System.out.println("Filter 2 works");
try (Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/filters?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC", "root", "password");
Statement stat = conn.createStatement()) {
} catch (SQLException e) {
e.printStackTrace();
}
In "try" line I have the error. I tried without "useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC" but it still didn't work. Here's a screen of the module settings -> Libraries. The JDBC is added there: https://i.stack.imgur.com/KzhqV.png
That's my first project when I'm using Tomcat and JDBC together. Should I connect them somehow before trying anything?