ok. i have got it.  thank you.
but i want ask one question more.
the root of the problem is caused by JDBC or DB2.
if i dont use a parameter marker  when i use ibatis ,i think it is not a
good idea for the security reason.  or just catch the exception and ignore
it?
and can you give some advice for this situation.

really thank you.


2010/3/23 Mario Ds Briggs <mario.bri...@in.ibm.com>

> ok... i will try to explain 1 more time.
>
> In DB2, if you use a parameter marker in the SQL query, then DB2  WILL
> 'constraint the paramter value to the db column length constraint'. If you
> dont use a parameter marker, then DB2 will NOT 'constraint the value to the
> db column length '
>
> cheers
> Mario
>
>
>
>
>             joson yu
>             <yuqian...@gmail.
>             com>                                                       To
>                                       user-java@ibatis.apache.org
>              03/23/2010 11:04                                           cc
>              AM
>                                                                   Subject
>                                       Re: db2 -302 error
>             Please respond to
>             user-j...@ibatis.
>                apache.org
>
>
>
>
>
>
>
> maybe i am not discribe clearly.
> the parameter's length is longger than the column length .but the the same
> sql.  in the db2 client is fine,but use ibatis it throw exception.
> the db constraint the column's lenth but don't constraint the  condition
> parameter's.but in ibatis ,it runs like it also constraint the parameter's.
>
> i don't know does i show the problem clear.
>
>
> 2010/3/23 Mario Ds Briggs <mario.bri...@in.ibm.com>
>  Hi Joson,
>
>  I guess you figured the error out yourself i.e. length of the parameter
>  value is > than the column length (30).   It works fine in db2 client
> since
>  there you are not using a parameter
>  marker but have value as a literal inside the SQL statement string.
>
>  cheers
>  Mario                 joson yu             <yuqian...@gmail.
>  com>
>  To                                       user-java@ibatis.apache.org
>              03/23/2010 07:44
>  cc
>  AM
>  Subject                                       Re: db2 -302
>  error             Please respond to
>  user-j...@ibatis.                apache.org
>
>
>
>
>
>
>
>  ps:in the sql the parameter should passed in with String  that is longger
>  than 30.
>
>  2010/3/23 joson yu <yuqian...@gmail.com>  there is an error happend in my
>  situation.and want to know is there  anyone else meet this problem.  i use
>  ibatis2.  the database is used  db2.  sql: select [columns] from  tables
>  where column1 = ''.  and the column1 is varchar type and it's length is
>  30.  the sql is execute fine in the db2 client. but when i use ibatis
>  to  execute it .it throw exception ,blow is all exception
>  info.        org.springframework.dao.DataIntegrityViolationException:
>  SqlMapClient  operation; SQL [];  --- The error occurred
>  in  com/hcss/fy/business/resource/ccr/model/HCSS_CCR_INFO_SqlMap.xml.  ---
>  The error occurred while applying a parameter map.  --- Check the
>  load_inheritor_baseinfo-InlineParameterMap.  --- Check the statement
>  (query failed).  --- Cause: com.ibm.db2.jcc.a.jm: DB2 SQL Error:
>  SQLCODE=-302,  SQLSTATE=22001, SQLERRMC=null, DRIVER=3.50.151; nested
>  exception is  com.ibatis.common.jdbc.exception.NestedSQLException:  ---
> The
>  error occurred
>  in  com/hcss/fy/business/resource/ccr/model/HCSS_CCR_INFO_SqlMap.xml.  ---
>  The error occurred while applying a parameter map.  --- Check the
>  load_inheritor_baseinfo-InlineParameterMap.  --- Check the statement
>  (query failed).  --- Cause: com.ibm.db2.jcc.a.jm: DB2 SQL Error:
>  SQLCODE=-302,  SQLSTATE=22001, SQLERRMC=null, DRIVER=3.50.151
>  at
>  
> org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:114)
>      at
>  
> org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
>      at
>  
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:212)
>      at
>  
> org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
>      at
>  
> com.hcss.fy.business.resource.ccr.dao.impl.InheritorDaoImpl.loadInheritor(InheritorDaoImpl.java:48)
>      at
>  
> com.hcss.fy.business.resource.ccr.dao.InheritorDaoTest.loadInheritor(InheritorDaoTest.java:57)
>      at
>  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at
>  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      at
>  
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      at
>  java.lang.reflect.Method.invoke(Method.java:597)
>  at
>  
> org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160)
>      at
>  
> org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233)
>      at
>  
> org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
>      at
>  
> org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
>      at
>  
> org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
>      at
>  
> org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
>      at
>  
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
>      at
>  
> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59)
>      at
>  org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:52)
>      at
>  org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
>      at
>  org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
>
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
>  For additional commands, e-mail: user-java-h...@ibatis.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: user-java-h...@ibatis.apache.org
>
>

Reply via email to