ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject Re: Problem with date format.
Date Fri, 30 Nov 2007 17:15:29 GMT

<br><font size=2 face="sans-serif">Agreed. You should transform the string
representation into a java.util.Date object before passing it off to the
database. (Regardless of the vendor) That way the JDBC driver will handle
the work for you. </font>
<br><font size=2 face="sans-serif">(Separation of concerns)</font>
<br><font size=2 face="sans-serif"><br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>&quot;Larry Meadors&quot;
&lt;lmeadors@apache.org&gt;</b> </font>
<br><font size=1 face="sans-serif">Sent by: larry.meadors@gmail.com</font>
<p><font size=1 face="sans-serif">11/30/2007 03:34 AM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
user-java@ibatis.apache.org</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">user-java@ibatis.apache.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: Problem with date format.</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Why use a string for a date? Let the driver do it
for you.<br>
<br>
Date date = new Date();<br>
<br>
queryForObject(&quot;some.query&quot;, date);<br>
<br>
&lt;select id=&quot;query&quot; resultClass=&quot;blah&quot;&gt;<br>
 &nbsp;Select *<br>
 &nbsp;from cust<br>
 &nbsp;where cust_date = #value#<br>
&lt;/select&gt;<br>
<br>
Larry<br>
<br>
<br>
On Nov 30, 2007 12:33 AM, Yuvraj Shinde &lt;Yuvraj.Shinde@sos.sungard.com&gt;
wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Hi all,<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &nbsp; &nbsp;I am using dd/MM/yy date format in search querry for
searching a data.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; For Eg<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Select * from cust where cust_date = 30/11/07<br>
&gt;<br>
&gt; it is giving me following exception<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; [Oracle JDBC Driver][Oracle]ORA-01843: not a valid month.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &nbsp;How to set or change the date format in Ibatis. can anyone help
me.<br>
&gt;<br>
&gt;<br>
&gt; &nbsp;Regards<br>
&gt;<br>
&gt; &nbsp;Yuvraj<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
</tt></font>
<br>

Mime
View raw message