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

x
?
Solved

need java.sql.Number documentation

Posted on 1997-09-18
5
Medium Priority
?
514 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
[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
  • 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 200 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

688 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