In my code I have a method whereby I am trying to connect either to a local server or a mainframe (only this first if statement is shown) but in the BOLDED line below I am getting a "Unhandled exception type ClassNotFoundException". Any help or direction would be appreciated.
I guess what I don't understand is why I am getting this error. Before putting the if statement around this statement within the try catch I did not get this error. Is it only because I put it in an IF statement? This file is already in the classpath so I do not understand WHY this error now came up.
Any insight would be appreciated.
Maximilian Xavier Stocker
Joined: Sep 20, 2005
There is more to it than the if statement. If you had the Class forName before then you must have made some other subtle change that gave it problems. Like you used to catch Exception and now you catch SQLException or you used to throws Exception in the method signature but now you only throw SQLException.
Something else changed. Class.forName throws ClassNotFoundException. It did before and it does now. So there was something else other than the if that meant that it wasn't a problem but now it is.
subject: Question on Unhandled Exception - please help!