File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet database connnetivity using MS SQL server

 
Catherine austin
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code runs fine but prints "failed connection" .
Here's the code :" form.html"



Code for servlet : "ganesha.java"




Kindly help me sort out this.
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're printing "Failed connection" in a finally block. That means it's always going to be printed - the finally block will always run (that's what it's for).

I suspect what you really wanted to do was print that out if there's an exception, in which case it needs to be in a catch block.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic