aspose file tools*
The moose likes JDBC and the fly likes database equivalent for XML time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "database equivalent for XML time" Watch "database equivalent for XML time" New topic
Author

database equivalent for XML time

Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
I am trying to insert xml element in time format(specified as of type time example 20:00:00 in XSD) into Oracle database.

What is the appropriate equivalent for time format as above in database representation? I tried timestamp, interval etc but none of them match the accept the above format.


Kishore
SCJP, blog
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

So your question is "I have this time, like 20:00:00, and how do I define and/or insert it in an Oracle database?"

Doesn't sound like an XML question to me. Let's move it to JDBC.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30929
    
158

Kishore,
You have a few choices here:
1) Date - convert to a Java Date and store that
2) String - convert to a Java String and store that
3) XML - some databases like Oracle 10g have built in XML support


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
I am using a tool called XSU to transform from XML to database columns. It is having problems if i define the 'time' based node from XML.

It only works in case i map it to a String, it has problems if i try to map 20:00:00 to a interval or date. I can not use String because i need to do sorting on these time stamps.

Any thoughts on this anamoly?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

Originally posted by Kishore Dandu:
I can not use String because i need to do sorting on these time stamps.
I don't understand this. Can you give an example of a pair of times that sort incorrectly when you use their string representations?
Tracy Nelson
Greenhorn

Joined: Sep 29, 2005
Posts: 12
You want to declare your column with the DATE type. If Oracle gives you a hard time about not specifying a date, you can attach an XSL script to your OracleXMLSave object and add one before saving.


Protect me from the things I want!
 
 
subject: database equivalent for XML time