程序写入日期(较大日期)报错 分析 (未解决)

web程序, db: IBM DB2 ,server :tomcat

前台日期控件,当日期控件取值最大为:2999-01-01,执行数据库插入操作时,报此错!

 

**UDOLink OPException:  executeUpdateBatch:Invalid data conversion:Requested conversion would result in a loss of precision of 360883
	at com.neusoft.udolink.common.impl.StoreManager.executeUpdateBatch(StoreManager.java:428)
	at com.neusoft.udolink.common.impl.DBPersistenceManagerImpl.executeUpdateBatch(DBPersistenceManagerImpl.java:1487)
	at com.neusoft.drm.common.impl.DBPersistenceManagerImpl.executeUpdateBatch(DBPersistenceManagerImpl.java:220)
	... 78 more
Caused by: com.ibm.db2.jcc.b.wg: Invalid data conversion:Requested conversion would result in a loss of precision of 360883
	at com.ibm.db2.jcc.b.r.a(r.java:139)
	at com.ibm.db2.jcc.b.tf.c(tf.java:672)
	at com.ibm.db2.jcc.b.tf.setInt(tf.java:657)
	at com.ibm.db2.jcc.b.tf.setObject(tf.java:1191)
	... 80 more

 

通过反编译,看到 r.java:139:

   final boolean a(Object obj, int i1)
        throws SqlException
    {
        switch(i1)
        {
        case 5: // '\005'
            return a(((Short)obj).shortValue());

        case 4: // '\004'
            return a(((Integer)obj).intValue());

        case -5: 
            return a(((BigInteger)obj).longValue());

        case 7: // '\007'
            return a(((Float)obj).floatValue());

        case 8: // '\b'
            return a(((Double)obj).doubleValue());

        case 3: // '\003'
            return a(((BigDecimal)obj).longValue());

        case -1: 
        case 1: // '\001'
        case 12: // '\f'
        case 503: 
        case 504: 
        case 505: 
            return b((String)obj);
        }
        throw new ug(o.k);
    }

 

debug看到: 传入参数2为: 360883

显然此方法,入参2 为int类型,最大值为65535,

360883>65535, 导致报dataConversation 错误!

但65535与时间有什么关系?

你可能感兴趣的:(db2,java 日期)