> I'm working in something related to DB to Java data types mapping and
> I'm not sure which java types should I use for the following DB2 types:
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.
udb.apdv.java.doc/doc/rjvjdata.htm
Arne
Andres G. - 16 Nov 2006 13:47 GMT
Thanks
Arne Vajh?j wrote:
> > I'm working in something related to DB to Java data types mapping and
> > I'm not sure which java types should I use for the following DB2 types:
>
> http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.
udb.apdv.java.doc/doc/rjvjdata.htm
>
> Arne
>Hi,
>
>I'm working in something related to DB to Java data types mapping and
>I'm not sure which java types should I use for the following DB2 types:
>DECIMAL -> Should I use Double?
>DOUBLE -> Should I use Double?
>REAL -> Should I use Double?
For these it depends on how much precision you need as opposed to how
much size. If you need many digits of precision you might need Java's
BigDecimal. If you need only a few digits precision but you need to
represent extremely large (10**30) or extremely small (10**-30), maybe
double would be a better fit.
>GRAPHIC -> ?????
>LONG VARGRAPHIC -> ?????
>VARGRAPHIC -> ?????
Don't know what these are, but I doubt that Java has anything that
really corresponds. Check the Blob interface, you might find something
there that would help.
>TIME -> java.sql.Time -> java.util.?????
>TIMESTAMP -> ?????
I expect the Java Time object would work here.
--
Tim Slattery
Slattery_T@bls.gov
> I'm working in something related to DB to Java data types mapping and
> I'm not sure which java types should I use for the following DB2 types:
[quoted text clipped - 7 lines]
> TIMESTAMP -> ?????
> VARGRAPHIC -> ?????
The standard (JDBC) mapping would be:
DECIMAL -> java.math.BigDecimal
DOUBLE -> Double
REAL -> Float
TIME -> java.sql.Time
TIMESTAMP -> java.sql.Timestamp
GRAPHIC, LONG VARGRAPHIC, VARGRAPHIC -> likely byte[]

Signature
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS (http://www.firstsql.com)