I am working on a webapp using JavaServer Pages and a MySQL database.
I moved my webapp into Apache Tomcat's .../webapps/ROOT
folder to run the application on local host. However, I no longer have my terminal to compile and run with an absolute path to the database driver jar files found in mysql-connector-java-8.0.17
. I have found a post that says to put the mysql-connector-java-8.0.17.jar
file into WEB-INF/lib
, but this has not fixed my problem.
How can I give my JSP file a classpath to the MySQL database driver so I can connect to it? If there is a different, better way of doing this, please let me know!
My code to connect is this:
String url = "jdbc:mysql://localhost:3306/***";
ResultSet rs = null;
try {
Connection conn = DriverManager.getConnection(url, "***", "***");
...
I am getting this exception:
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/***.
If there is more information to include, please let me know!