This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes How to delete the row from the Database by using while loop in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to delete the row from the Database by using while loop in servlet" Watch "How to delete the row from the Database by using while loop in servlet" New topic
Author

How to delete the row from the Database by using while loop in servlet

Anjaneyulu Mannam
Greenhorn

Joined: Mar 02, 2011
Posts: 5

Dear Sir/Madam,

I am trying to delete the one user data in the Oracle SQL server database by using Servlet program (Tomcat server).

In Database table have 6 users details are there.

Table name is "JDUSER" and columns are USERS (Char), PASS (Varchar2) and CODE (Varchar2). I am trying to delete 4th user details.

While loop is not terminate, in while loop why If condition not working it checking until end of the table and gives else black statement. So what is my mistake and please give the solution to me.

My HTML code is:




My Database table is:



My JavaServlet Program is:




So finally where is my mistake and in while loop If condition true even though if loop not working.
i am given 4th usre details in HTML page. Please give me solution.

Mail ID : maamanambros@gmail.com
Krishna Madhava
Greenhorn

Joined: Sep 21, 2007
Posts: 11
Hi,

please check your delete query.

the correct syntax is delete from table where fieldname='value';

once query is modified, hope it will delete the row from the Database

thanks.
ramakrishna rayudu
Ranch Hand

Joined: Mar 08, 2011
Posts: 57
Hi..

As per the Good Guidelines All ways You Should Not write any DataBase Related Code in your Servlet.
follow this...
All way The Request Should received By Servelt And it need to Call Any Back end Java Classes Normally Called As Beans(Spring Beans/EJB Beans).
and get The Data from the Beans need to Forward Any jsp page for View Purpose


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to delete the row from the Database by using while loop in servlet