Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

database equivalent for XML time

 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Posts: 21941
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 35975
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21941
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!