I know previously people told me not to use the database with the servlet, but its part of a set of a piece of work i have been set, so i have no choice about that.
I have a form which submits an ID, i then get this ID using my servlet and feed it into an operations method i have to delete a student with the supplied ID.
I have made a tester class separate from my servlet that i use to add, delete and display the students to check my operations methods are working and i am connecting with the database.
This class works fine. When i use the code below in my servlet, which uses the method in the same way that i have tested it gives me an error. In the browser i get no error, it just shows me a blank page. When i look at the console output it says
INFO: SQLExceptionjava.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/university
Maybe i should add that i am using a MySQL database and a glassfish server both set up on my computer. I don't understand how it works fine on its own but throws a no suitable driver found error when i use it within my servlet?
.jar file is in a folder called lib in my main project folder. I then right click on libraries in my IDE and add the jar, it creates the classpath for me. This has worked in the past for me, i had just assumed it would work in the same way with servlets.
Joined: Apr 27, 2012
Well it is clear now i have to add the classpath to the server, according to the netbeans documentation, it should do this automatically if a checkbox is ticked, which i already have. So i don't know why it is not recognising it still.