ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Goodin" <brandon.goo...@gmail.com>
Subject Re: IBatis+teradata
Date Mon, 14 Apr 2008 13:23:29 GMT
iBATIS uses straight jdbc underneath. If the field in your database is a
varchar and the bean property is a Date object it will be up to the jdbc
driver to perform the conversion.  You can make sure that iBATIS is using
the proper PreparedStatement calls if you explicitly specify the type of the
bean property and database column.

Brandon Goodin

On Mon, Apr 14, 2008 at 8:14 AM, Radoslaw Zmuda <radek.zmuda@gmail.com>

> Hi All,
> The scenario of my problem is as follows:
> - I've tried to prevent my app against SQL injection, so I changed  a '$'
> signs into '#' signs in xml files where value of parameters are added
> - the problem was solved but there appears another one: problem with Date
> object insertion.
>   Previously (when '$' signs where present) the Date object was converted
> into String in my code, so into statement was placed i.e.'2008-14-03' and
> the fields was correctly placed on Teradata db (db field types of Date)
> - After changing into '#' signs I get the following message from terradata
> jdbc driver :
> com.ncr.teradata.jdbc_4.util.JDBCException: [NCR] [Teradata DBMS] :
> Invalid date supplied for TABLE_NAME.DATE_FIELD_NAME.
> It is no matter if Date is converted into String or it is pure Date
> object.
> I'm guessing that IBatis converts Date into yyyy-mm-dd hh:mm:ss format and
> this looks like DateTime type rather than Date for teradata.
> So my question is: is there any possibility to reconfigure default format
> for IBatis date or if there is any other soluition to this problem.
> Here is piece of code from which insertion starts:
> // insert
>         QueryParams qp = newQP(gtd);
>         setUpdates(qp, gtd, row, true, true);
>         getSqlMapClientTemplate().insert(makeName("insert"), qp);
> Best Regards,
> Radek

View raw message