I’m running Oracle 10g and have columns with Type_Name
TIMESTAMP(6) WITH TIME ZONE
When inflated into java classes they come out as
oracle.sql.TIMESTAMPTZ
But DbUnit can’t handle converting Oracle specific classes to Strings for writing to XML. I’m wondering if there’s any easy way for me to convert (say, in my SELECT statement somehow) from these Oracle specific timestamps to something in java.sql.
I haven’t had to deal with this problem exactly, but I presume that having it come through as a string from the SELECT query would be fine.
You could use the to_char function. To convert it to a string. e.g:
This would then be seen by your program as a string.
TZDincludes timezone information (of which there is none in this example)Later, this could then be parsed by Java using the SimpleDateFormat class.
Alternatively, the oracle.sql.TIMESTAMPTZ class has a method called
dateValuethat returns ajava.sql.Dateclass.