Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

Java to DB2 data types Mapping

Thread view: 
Andres G. - 15 Nov 2006 22:23 GMT
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?
GRAPHIC -> ?????
LONG VARGRAPHIC -> ?????
REAL -> Should I use Double?
TIME -> java.sql.Time -> java.util.?????
TIMESTAMP -> ?????
VARGRAPHIC -> ?????

Thanks in advance.
Arne Vajhøj - 16 Nov 2006 01:10 GMT
> 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
Tim Slattery - 16 Nov 2006 14:22 GMT
>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
Lee Fesperman - 21 Nov 2006 01:01 GMT
> 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)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.