File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlets with JDBC connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlets with JDBC connection" Watch "Servlets with JDBC connection" New topic
Author

Servlets with JDBC connection

Madhawi Maurya
Ranch Hand

Joined: Aug 22, 2007
Posts: 42
hi,

I got a problem while making a servlet program. Please help me.

My problem is:

When i am loading mySQL driver in my servlet program, run time error "ClassNotFoundException" is coming. But when i load same driver in my simple program using main() method, it runs successfully.

Please tell me why this problem is coming with servlet program and also give me the solution.

Thanks & Regards,
Madhawi


SCJP1.5 with 90%
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Include MySQL driver's JAR file in your class path, that's all!!!


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Madhawi Maurya
Ranch Hand

Joined: Aug 22, 2007
Posts: 42
Originally posted by Vassili Vladimir:
Include MySQL driver's JAR file in your class path, that's all!!!


Thank you Vassili.
[/LIST]
Madhawi Maurya
Ranch Hand

Joined: Aug 22, 2007
Posts: 42
But After loading the driver i got another problem.

I have created a html file in which two fields login and password has mentioned. when i submit the html file, the servlet page will open, the servlet page will store the login and password in database and after that it will display all content of my login table.

Problem is that, when i submitting my html file it opens a download dialog box, from that box i can open a file or save a file or can cancel the further process. when I select open, I have to choose a file type in which i can see my output, I choosed internet explorer. And it is showing the output of my sevlet file. Can it show directly without open with or save as option?

My Servlet program is as follows:




[BSouther: Added UBB CODE tags]
[ October 13, 2007: Message edited by: Ben Souther ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41601
    
  55
You have a typo in the content type; it should be "text/html".


Ping & DNS - my free Android networking tools app
Madhawi Maurya
Ranch Hand

Joined: Aug 22, 2007
Posts: 42
Originally posted by Ulf Dittmer:
You have a typo in the content type; it should be "text/html".


thanks for the help to aware my mistake at content type.
 
jQuery in Action, 2nd edition
 
subject: Servlets with JDBC connection