permaculture playing cards*
The moose likes JDBC and the fly likes Error 500 when trying to run servlet connecting to mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error 500 when trying to run servlet connecting to mysql " Watch "Error 500 when trying to run servlet connecting to mysql " New topic
Author

Error 500 when trying to run servlet connecting to mysql

B Crosthwaite
Ranch Hand

Joined: Oct 22, 2008
Posts: 39
Hi Everyone,

I have wrote this piece of code to test whether I can connect to my MySQL database with a servlet.


When I run the servlet I am presented with the error 500 message, the error message reads:


Does anyone have any idea where I am going wrong?

Thanks,
-Ben
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
You will have to go through the usual procedure for finding a NullPointerException (NPE). Start by identifying the line where it occurs (35) and check that every object used in that line is not null.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Also, check your error logs.


These two pieces of code log an error and then continue. If either of these fails, the code later in the method doesn't make sense though. It's better to just log the error, throw a RuntimeException and stop trying.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
B Crosthwaite
Ranch Hand

Joined: Oct 22, 2008
Posts: 39
Hi Guys thanks fot the replys,

I just want to make sure of something.....

If I had set up the JDBC driver Incorrectly would I be able to complie the code in the above post?

I realise that this is a strange question considering the first post I made but I would just like to make sure I have installed the driver correctly.

Thanks,
Ben
 
wood burning stoves
 
subject: Error 500 when trying to run servlet connecting to mysql