Good point. I'm using TOAD, which I think also has a similar problem. The ultimate solution for me was to use TIMESTAMP as the data type.

Thanks,
- Paul


At 05:35 PM 9/1/2006, you wrote:
Paul,
 
How are your verifying that you are only getting the year+month+day? I know this one seems a bit odd but Oracle probably is storing the date for you, down to the milliseconds. If you are using SQL+ to examine your data chances are that it is formatting it based upon setting on the database or within the SQL+ environment itself. I know in SQL+, when I was using it, I would be forced to specify the column format for a given column to ensure that I could see the actual values of the data in the format that I wanted.
 


From: Paul Allen <[EMAIL PROTECTED]> [ mailto:Paul Allen <[EMAIL PROTECTED]>]
Sent: Friday, September 01, 2006 12:47 PM
To: [email protected]
Subject: getting data and time into Oracle records

Could somebody share with me the secret to getting dates AND times into Oracle DATE fields from java.util.Date properties?

Even when I set the time portion of the java.util.Date I end up only with the year+month+day in the DB.

In a related question, where is the definative documentation for the allowed format of inline parameters (i.e., the stuff between "#" and "#")?

Thanks for any help you can offer.

Here's what I'm doing now:

--- Java Class ---

public class MyBean {
        private java.util.Date myDate;
        ...
        public java.util.Date getMyDate() {...}
        public void setMyDate(java.util.Date _myDate) { ... }
}


--- Ibatis Map ---

<insert id="insertMyBean" parameterClass="MyBean">
        INSERT INTO MYTABLE (MYDATE) VALUES (#myDate:DATE#)
</insert>

--- Oracle Table ---

CREATE TABLE MYTABLE
(
  MYDATE DATE
)

Reply via email to