David Newton wrote:What's DSN?
Have you looked at any of the countless MySQL/JDBC tutorials available on the web?
http://www.vogella.de/articles/MySQLJava/article.html
(for example).
Moving to JDBC for now as it's not really related to servlets, unless you're trying to use JNDI.
DSN: DATA SOURCE NAME or SUBNAME which comes in the jdbc url.
<protocol>:<subprotocol>:<subname/dsn>
By the way thanks for your link. I will read it and learn.
Anyways I found something useful in
here
Now my servlet is picking up data from mysql....
Following happens to be the connectiong code in my program:
I downloaded the Connector/J driver from mysql's site and as per instructions I read in one of the websites I place the .jar in jre/lib/ext folder. Now I have read this in Kathy Sierra book that we use this folder structure to access jar only in development time. So whats the other alternative to this?
Also I found something very strange. After I placed the driver's jar in jre/lib/ext folder, servlet was still not connecting and through exception handling I found that it could not locate the driver. Then when I turned off the PC and restarted later, it was working fine. and now it is picking data from mysql. What could be the reason???
A special thanks to Sudipta Laha for suggesting to check mysql documentation
Thanks