ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bondre, Prathit" <pbon...@chdist.com>
Subject RE: iBatis Subquery and Date error
Date Thu, 26 Jan 2006 18:06:57 GMT
Ok. I will try turning the logging on and see what the actual SQL is.

Thanks for your help.

I will post my results soon.

 

________________________________

From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Thursday, January 26, 2006 11:59 AM
To: user-java@ibatis.apache.org
Subject: Re: iBatis Subquery and Date error

 

I think you need to turn on logging and see what's actually being sent
to the DB.  Something is messed up, but it's hard to tell what it is.

 

Jeff Butler

 

On 1/26/06, Bondre, Prathit <pbondre@chdist.com> wrote: 

Hi Jeff,

 

I have tried that as well.

I am able to run it if I hard code the value. So my string format seems
to be ok.

For e.g.

If I change my query to 

Insert into table 
Select
  Address,
  City,
  Zip,
  'Fred' as name,
 '2006-01-01' as date
>From Table
Where Id = #id#

 

it works.

 

But as soon as I pass it as a string in the hashmap it gives me the data
type mismatch error.

 

 

________________________________

From: Jeff Butler [mailto: jeffgbutler@gmail.com] 
Sent: Thursday, January 26, 2006 11:44 AM 
To: user-java@ibatis.apache.org
Subject: Re: iBatis Subquery and Date error

 

My guess is that you've not really got the String format for a Date
right for your database.  It is notoriously difficult to specify a
String for a date.  You might try to prototype the insert statement in
some interactive database client (like squirrel) to get it working
before you try the iBATIS stuff. 

 

You probably also need to do a "cast" - use the database function to
convert a String to a date.  If you were using DB2, it would look like
this: 

 

Insert into table 
Select
  Address,
  City,
  Zip,
  'Fred' as name,
  date('yyyynnn') as date
>From Table
Where Id = #id# 

Where 'yyyynnn' is a Julian date.

Jeff Butler

 

On 1/26/06, Bondre, Prathit < pbondre@chdist.com
<mailto:pbondre@chdist.com> > wrote: 

Hi Jeff,

 

Thanks for your response.

I tried that as well but when I pass in a String with the database
specific format it give me a cast mismatch error. 

"Value not compatible with the datatype of its assignment target".

 

Any ideas?

 

 


Mime
View raw message