File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes calculation on data retrieved from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "calculation on data retrieved from database" Watch "calculation on data retrieved from database" New topic
Author

calculation on data retrieved from database

Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 49

problem in retrieving data from database
i want to do calculation on data retrieved from database
first two rows it prints perfectly but after that it terminates where calculation starts


i don't know what i am doing wrong


Don't aim for success if you want it; just do what you love and believe in, and it will come naturally.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
What does "it terminates" mean? What is or isn't executed? Are there any error messages in the log files?


Ping & DNS - updated with new look and Ping home screen widget
Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 49

this not throwing any exceptions
it terminates where the callculations start
see output

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
this not throwing any exceptions

Are you sure about that? There isn't an empty catch block somewhere, is there?

Does the ResultSet contain a column called "discount"?

By the way, you should never do calculations involving amounts of money using integers (or floats or doubles); use BigDecimal instead.
Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 49

Are you sure about that?

yes i am sure.there is no empty catch block there
there is column in my database called discount
from where i am retrieving value
Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 49

problem is solved
i have two catch blocks in my code with same objects like this
i change

to


and it works
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calculation on data retrieved from database
 
Similar Threads
HTTP STATUS 404: requested resource is not available.
Distinct names for multiple buttons
servlets using JDBC
servlets using JDBC
send variable value from one servlet to another servlet for itext pdf