Thanks I have some studying to do. I will have to try to use the BigDecimal data type in apache derby db. All my forms collect values for double. The JFormattedTextFields wlll allow input of doubles of any size so maybe I will just have to re-write and convert them to BigDecimal in order to save them. When I address this
I will try to supply some code to show a simple example for using BigDecimal.
I have not found to many examples stressing the use of BigDecimal thou it
is an essential concept.
Thank you for your time.
Steve Howerton wrote:In my Apache derby db I set up Decimal data types like this:I use JFormattedTextFields to filter decimal usage in text fields concerning money
Like admin pay rate would be 150.00: this is good.
In the JFormattedTextField it will allow 1,000.00 but the db crashes when this
Decimal is presented.
Will I have to change the db data type ?
Going back to your original question, the answer is YES. If you need to pass a value that is more than 999.99, then you will have to change the database definition, regardless of what Java type you use.
However, you should still heed the good advice you've been given.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Campbell Ritchie wrote:Oh, I forgot. Zimbabwean dollars don’t have absolute values. They shrink as you watch. Sorry for the mistake.
Actually, I believe it is no more. It has ceased to be. This, from Wikipedia:
"..the use of the dollar as an official currency was effectively abandoned on 12 April 2009. This was a result of the Reserve Bank of Zimbabwe legalizing the use of foreign currencies for transactions in January 2009.
Currencies such as the South African rand, Botswana pula, pound sterling, euro, and the United States dollar are now used for all transactions in Zimbabwe; the policy of the government of Zimbabwe has insisted that any attempts to reintroduce Zimbabwean currency should be considered only if industrial output improves...."
Not surprising I suppose when they had a Z$100-trillion note. I imagine the ink to print the zeroes was a a limiting factor.
Thanks for the input. I really can not offer a good code example but I can say that I use Netbeans and I had to insure that BigDecimal was imported because it was
Allowing me to use methods from the pkg but there was no import for BigDecimal and it did not indicate it. I found very few examples but the Compound Interest example
Mentioned does offer some relative conventions.
The problem is that a lot of people who teach computing don’t know about it, so you get few examples in tutorials. People who write banking applications know all about BigDecimal, and they always post their code on the net, don’t they.
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss