Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 526
  • Last Modified:

need java.sql.Number documentation

Where can I get the class documentation for the
java.sql.Number class. Not the documentation
produced by javap but the real stuff.
0
mmoore
Asked:
mmoore
  • 3
  • 2
1 Solution
 
gwaltersCommented:
I can't find any such thing in java.sql.  Are you sure you don't want java.lang.Number?


0
 
mmooreAuthor Commented:
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
 
mmooreAuthor Commented:
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
 
gwaltersCommented:
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
 
mmooreAuthor Commented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now