This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes DATA RETREIVAL _ URGENT Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "DATA RETREIVAL _ URGENT" Watch "DATA RETREIVAL _ URGENT" New topic
Author

DATA RETREIVAL _ URGENT

jamuna
Greenhorn

Joined: Feb 16, 2001
Posts: 8
I'm trying to retreive data from a table.the column type is decimal(8,2).it's an amount and I've inserted a value 123.45 in the table.when I try to retreive this value in the servlet and display using rs.getDouble("amount") it shows as 12345.0 .I'm using the mysql database.Could you please help me in fixing this problem.
Thanks,
Jams
Keith Cochran
Greenhorn

Joined: Feb 20, 2001
Posts: 4
In the short term, you can always divide the result by 100.
Make sure you're SQL is correct. It should look like:
INSERT INTO MyTable(dec_val) VALUES(123.45)
Try looking at the table using WinSQL or some other query tool
to make sure the db is storing the data correctly.
Keith
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
JAMUNA
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Originally posted by jamuna:
I'm trying to retreive data from a table.the column type is decimal(8,2).it's an amount and I've inserted a value 123.45 in the table.when I try to retreive this value in the servlet and display using rs.getDouble("amount") it shows as 12345.0 .I'm using the mysql database.Could you please help me in fixing this problem.
Thanks,
Jams

My first guess is that the JDBC drive code you are using may
have a mistake If you have the source, check to see how the
getDouble is implemented. Or, get another driver for MySQL
(refer to mysql.org). I've had to fix JDBC source before.
Jim
Software Engg
Greenhorn

Joined: Feb 19, 2001
Posts: 10
hai jamunu,
Just check out b4 inserting nothing wrong in the code it should work fine
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
"Software Engg",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
This name is obviously a pseudonym, and will be turned off very soon. Please choose a new name immediately.
Thanks.

A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: DATA RETREIVAL _ URGENT
 
Similar Threads
FORM DATA RETREIVAL...................URGENT!!!!!!!!!!!!!!!!!!!!!!!!!!!
FORM DATA RETREIVAL URGENT
form data retreival
Retreiving an image using JDBC
BigDecimal in EL addess scales