Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting Exponential values when insertinbg to database

Posted on 2004-03-28
11
Medium Priority
?
346 Views
Last Modified: 2010-08-05
I am using JSP deployed on Tomcat with Oracle 8i as database. My problem is when i insert a large value(say 10 digits)  using JSP in my database it gets inserted as something like 4.8E9
I am usin Double datatype in JSP and the width of column in Oracle is also defined as NUMBER(20,2).
0
Comment
Question by:anna_1980
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 7

Expert Comment

by:searlas
ID: 10702387
What are you using to view the Oracle values?  Have you tried reading the values back out of Oracle using JDBC?
Basic question, is this actually a problem, or is it just the appearance of the number that concerns you?
0
 
LVL 6

Expert Comment

by:jarasa
ID: 10702610
Try using Float.
Javier
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10705534
follow what other experts have suggested. if you have problem on displaying value in web page, then your might also want to look into java.text.DecimalFormat
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:anna_1980
ID: 10710494
>>What are you using to view the Oracle values?  Have you tried reading the values back out of Oracle using JDBC?
Basic question, is this actually a problem, or is it just the appearance of the number that concerns you?

--Yes, I am using JDBC and fetching the values back using ResultSet.  
This is indeed a problem because users don't like it that way.


>>Try using Float.

--Tried that.Infact I started with using Float but then switched to Double thinking it may solve the problem.



0
 
LVL 14

Accepted Solution

by:
kennethxu earned 600 total points
ID: 10710576
then, you indeed need java.text.DecimalFormat

java.text.DecimalFormat df = new java.text.DecimalFormat( "#,###0.00" );
...
double amount = rs.getDouble( "column_name" );

...
<p>amount: <%=df.format( amount )%></p>
0
 
LVL 6

Expert Comment

by:jarasa
ID: 10711738
Can you post you code to see if is something starnge on it?
Javier
0
 

Author Comment

by:anna_1980
ID: 10711763
Thanks everyone for helping
0
 
LVL 7

Expert Comment

by:searlas
ID: 10711983
Gotta acknowledge kennethxu's expreience here; avoiding the trap of taking the problem description as gospel, seeing through it, and solving the actual problem... (presentation of numbers on screen, NOT in the database)

0
 
LVL 6

Expert Comment

by:jarasa
ID: 10712064
Doesn't he got the Points??

:c)

Javier

P.D.: I agree Searlas.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10715825
you guys are making fun on me :-)
I would like to pass some points but just afraid somebody in the forum will again starts crying. Missing those days that can enjoy a peaceful forum with you guys.
0
 
LVL 6

Expert Comment

by:jarasa
ID: 10721927
Hmm as I see it, points mean nothing here* , well is good that EE has given us unlimited points to ask I appeciate that even while I don't ask much, but what I really miss is a place to talk and get to know each other a bit better.

I really enjoy helping ppl here and that's becose we can make a laugh from time to time :c))

Javier

* To tell the truth I like to see my name on the list :cP
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question