Solved

need java.sql.Number documentation

Posted on 1997-09-18
5
465 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 87
Java Filesystem manipulation of Word Docx file (find replace text) 3 67
github account with ecipse 1 42
web services creation SOAP vs REST 5 21
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

863 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

27 Experts available now in Live!

Get 1:1 Help Now