我在测试的时候,向数据库里插入数据,如果插入的是英文,没有问题,如果是中文,build报错:
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at fes.common.dao.FesScriptsetDAO.attachDirty(FesScriptsetDAO.java:169)
at fes.logic.scriptset.ScriptSetImp.AddScriptSet(ScriptSetImp.java:55)
at core.ApplicationProxy.addScriptSet(ApplicationProxy.java:68)
at core.Mytest.main(Mytest.java:44)
Caused by: java.sql.BatchUpdateException: ORA-01461: can bind a LONG value only for insert into a LONG column at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8738)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 11 more
去网上看了下,有人说是JDBC驱动跟oracle版本的问题,但是我试了下,还是没解决,哪个大侠帮帮我

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主截止到2008-06-18 09:44:05的汇总数据:
    发帖数:1
    结贴数:0
    结贴率: 0.00%
    如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
      

  2.   

    我的OJDBC14已经更新到跟oracle一样的版本了,但build的时候还是会出错,我测试的时候还没有用到网页,我的测试代码只是main函数里测试的,build出错
      

  3.   


    深层次的原因是这个,你看你批量插入的值中是不是有不是Long型的。比如你插入了一个非数字的值到long这个字段中去
    Caused by: java.sql.BatchUpdateException: ORA-01461: can bind a LONG value only for insert into a LONG column 
      

  4.   

    我在测试的时候,向数据库里插入数据,如果插入的是英文,没有问题,如果是中文,build报错: Caused by: java.sql.BatchUpdateException: ORA-01461: can bind a LONG value only for insert into a LONG column 
    说的很清楚了
    你传了String进去,可是他是Long的,所以报错
    解决办法
    1.就只传Long
    2.把字段改成String类型的
    3.穿之前就限制他不能输入英文或者数字
      

  5.   

    谢谢,可是我的数据库里不是Long的,是String的,
      

  6.   

    数据库里一直都没有字段是long型的啊
      

  7.   

    数据库是没有long型的字段,但是你插入数据的时候里面long值吧,异常栈的意思很明白:
    Long型的数据只能绑定在Long型的列上面,
    如果你确定数据库中没有Long型的列的话,那么你可能是把Long型的数据绑定在了一个非Long型的列上,所以检测一下你程序中的数据是否有Long型的,设置一个条件断点跟一下就可以了。
      

  8.   

    我都弄了一天半了,急啊,数据库里根本就没有long类型的字段,我插入的也是string,搞不懂了,急死我啦
      

  9.   

    我的数据库里都是varchar类型,我在insert的时候也都是这样添加的,: fst.setMainTraditional("繁体中文");
    fst.setMainSimplifed("zzzzzzzzzzz");
    fst.setMainEnglish("mainEnglish");
    fst.setRecallTraditional("recallTraditional");
    fst.setRecallSimplifed("Simplifed");
    fst.setRecallEnglish("dfdfdfdff");
    fst.setEndTraditional("endTraditional");
    fst.setEndSimplifed("endSimplifed");
    fst.setEndEnglish("endEnglish");
    fst.setCreateUserId("createUserId");
    fst.setCreateDate(new Date());
    fst.setUpdateUserId("updateUserId");
    fst.setUpdateDate(new Date());
    fst.setpkey("402882a41a7c0814011a7c0e0f380003");
      

  10.   

    oracle驱动问题,我原来用的是ojdbc14.jar 10.1.0.2.0,去下了一个ojdbc14.jar 10.2.0.3.0换上,立马就好了