Solved

need java.sql.Number documentation

Posted on 1997-09-18
5
462 Views
Last Modified: 2012-06-21
Where can I get the class documentation for the
java.sql.Number class. Not the documentation
produced by javap but the real stuff.
0
Comment
Question by:mmoore
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:gwalters
ID: 1227129
I can't find any such thing in java.sql.  Are you sure you don't want java.lang.Number?


0
 
LVL 3

Author Comment

by:mmoore
ID: 1227130
Well, I do a javap java.sql.Numeric and get

Compiled from Numeric.java public final class java.sql.Numeric extends
java.lang.Number {
    static final int SRADIX;
    public static final java.sql.Numeric ZERO;
    public static final java.sql.Numeric ONE;
    public static void setRoundingValue(int);
    public static int getRoundingValue();
    public java.sql.Numeric(java.lang.String);
    public java.sql.Numeric(java.lang.String,int);
    public java.sql.Numeric(int,int);
    public java.sql.Numeric(int);
    public java.sql.Numeric(long,int);
    public java.sql.Numeric(long);
    public java.sql.Numeric(double,int);
    public java.sql.Numeric(java.sql.Numeric);
    public java.sql.Numeric(java.sql.Numeric,int);
    public static java.sql.Numeric createFromByteArray(byte[]);
    public static java.sql.Numeric createFromIntegerArray(int[]);
    public static java.sql.Numeric createFromScaled(long, int);
    public static java.sql.Numeric createFromRadixString(java.lang.String,
int);
    public static java.sql.Numeric random(int, java.util.Random);
    public int intValue();
    public long longValue();
    public float floatValue();
    public double doubleValue();
    public java.lang.String toString();
    public java.lang.String toString(int);
    public int getScale();
    public long getScaled();
    public java.sql.Numeric add(java.sql.Numeric);
    public java.sql.Numeric subtract(java.sql.Numeric);
    public java.sql.Numeric multiply(java.sql.Numeric);
    public java.sql.Numeric divide(java.sql.Numeric);
    public java.sql.Numeric integerDivide(java.sql.Numeric)[];
    public java.sql.Numeric remainder(java.sql.Numeric);
    public java.sql.Numeric sqrt();
    public java.sql.Numeric pow(int);
    public boolean equals(java.lang.Object);
    public boolean lessThan(java.sql.Numeric);
    public boolean lessThanOrEquals(java.sql.Numeric);
    public boolean greaterThan(java.sql.Numeric);
    public boolean greaterThanOrEquals(java.sql.Numeric);
    public int hashCode();
    public java.sql.Numeric setScale(int);
    public int significantBits();
    public java.sql.Numeric shiftRight(int);
    public java.sql.Numeric shiftLeft(int);
    public java.sql.Numeric modInverse(java.sql.Numeric);
    public java.sql.Numeric modExp(java.sql.Numeric, java.sql.Numeric);
    public boolean isProbablePrime();
    public static java.sql.Numeric pi(int);
    static void div(java.sql.Numeric, java.sql.Numeric, java.sql.Numeric);
    static static {};
}

So I think it does exist.
0
 
LVL 3

Author Comment

by:mmoore
ID: 1227131
What I am really trying to figure out is how to load a string
without rounding it.
I have loaded a string with
java.sql.Numeric xyz = new java.sql.Numeric(strVar);
but if my string strVar is 2.5 it gets rounded up to 6.
It is not clear to me from the javap output what I need
to do to control the rounding. So, if you can tell me how
to do this, the points and my thanks are yours.
0
 
LVL 3

Accepted Solution

by:
gwalters earned 50 total points
ID: 1227132
How about java.lang.Float (you only need Float, since java.lang.* is implicitly imported).

float x = (new Float(strVar)).floatValue();

Should work without rounding.
0
 
LVL 3

Author Comment

by:mmoore
ID: 1227133
Ah, I had actually tried using a float first, but once I
got it into java.lang.Float, I did not know how to get
it into float. I am using JDBC which requires float.
(as opposed to java.lang.Float)
So, I did as you said and the number went straight into
the Oracle database no problem, except that the number
was still being rounded. Further investigation revealed
that I had defined the database column as number(3).
So, THAT was my problem all along. Oh well, at least I
learned a few things along the way. :-) {I'd still like to
find the java.sql.Numeric documentation.}
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumHeights2  challenge 7 76
bunnyEars2 challenge 6 67
base64 decode encode 12 96
how do i compare an object based on two fields 6 28
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now