This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes servlet database connnetivity using MS SQL server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "servlet database connnetivity using MS SQL server" Watch "servlet database connnetivity using MS SQL server" New topic
Author

servlet database connnetivity using MS SQL server

Catherine austin
Ranch Hand

Joined: Jul 20, 2011
Posts: 43
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

Joined: Apr 06, 2010
Posts: 4425
    
    8

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
 
subject: servlet database connnetivity using MS SQL server