ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject RE: getting data and time into Oracle records
Date Fri, 01 Sep 2006 21:35:12 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META boundary="=====================_1400674000==.ALT" alternative; multipart 
Content-Type:>
<META http-equiv=Content-Type content="text/html; charset=us-ascii" 
Content-Type: --="====================_1400674000==.ALT" html; text>
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=371513121-01092006><FONT color=#0000ff

size=2>Paul,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=371513121-01092006><FONT color=#0000ff

size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=371513121-01092006><FONT color=#0000ff

size=2>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. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=371513121-01092006><FONT color=#0000ff

size=2></FONT></SPAN>&nbsp;</DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Paul Allen &lt;pea1@cornell.edu&gt;

[mailto:Paul Allen &lt;pea1@cornell.edu&gt;] <BR><B>Sent:</B> Friday,
September 
01, 2006 12:47 PM<BR><B>To:</B> user-java@ibatis.apache.org<BR><B>Subject:</B>

getting data and time into Oracle records<BR></FONT><BR></DIV>
<DIV></DIV>Could somebody share with me the secret to getting dates AND times

into Oracle DATE fields from java.util.Date properties? <BR><BR>Even when I set

the time portion of the java.util.Date I end up only with the year+month+day in 
the DB.<BR><BR>In a related question, where is the definative documentation for

the allowed format of inline parameters (i.e., the stuff between "#" and "#")? 
<BR><BR>Thanks for any help you can offer.<BR><BR>Here's what I'm
doing 
now:<BR><BR>--- Java Class ---<BR><BR>public class MyBean 
{<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB>private

java.util.Date 
myDate;<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB>...<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB>public

java.util.Date getMyDate() 
{...}<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB>public

void setMyDate(java.util.Date _myDate) { ... }<BR>}<BR><BR><BR>---
Ibatis Map 
---<BR><BR>&lt;insert id="insertMyBean" 
parameterClass="MyBean"&gt;<BR><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB>INSERT

INTO MYTABLE (MYDATE) VALUES (#myDate:DATE#)<BR>&lt;/insert&gt;<BR><BR><FONT

size=4>--- Oracle Table ---<BR><BR></FONT>CREATE TABLE MYTABLE<BR>(<BR>&nbsp;

MYDATE DATE<BR>) </BODY></HTML>


Mime
View raw message