Re: Confusing facts...
getsanjay.sharma@gmail.com wrote:
Thanks a lot my friends for your answers and sorry for the double
posting. It was a mistake. Also apologies to all those people who must
have got my mail by mistake, I am not very used to newsgroup postings.
The question hanging in my mind is why the function:
Class.forName("com.mysql.jdbc.Driver") works in a standalone setup(a
normal void main program) while the same line when using servlets
throws a "com.mysql.jdbc.Driver not found Exception"? I thought this
shouldn't happen since I am creating projects in Eclipse and importing
the required jar files in the same way as always.
You don't import JARs. What are you actually doing?
Even the code:
com.mysql.jdbc.Driver d = new com.mysql.jdbc.Driver();
Connection conn = d.connect(url, properties_object);
throws a ClassDefNotFoundException. I guess I am against a blank wall.
It would be really appreciated if someone could shed light on this....
Either include the JAR as a library in the web-app project properties or store
in in the web/WEB-INF/lib/ folder.
You need to study how servlet containers find classes.
--
Lew