aspose file tools
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 52

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
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
What does "it terminates" mean? What is or isn't executed? Are there any error messages in the log files?
Karamjeet singh
Ranch Hand

Joined: Feb 24, 2010
Posts: 52

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

Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
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: 52

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: 52

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