aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Servlet and database issue in IDE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Servlet and database issue in IDE" Watch "Servlet and database issue in IDE" New topic
Author

Servlet and database issue in IDE

tom davies
Ranch Hand

Joined: Apr 27, 2012
Posts: 168
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?

Servlet is below
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61755
    
  67

Where did you put the driver jar file?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
tom davies
Ranch Hand

Joined: Apr 27, 2012
Posts: 168
.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.
tom davies
Ranch Hand

Joined: Apr 27, 2012
Posts: 168
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet and database issue in IDE