ITeye博客

oracle中文出现错误

lin5061 · 2007-05-15 05:46 · DataBase · Markdown

今天把oracle换了一下安定北京,但是原来的代码没换,测试添加数据时报了一个莫名的错误:can bind a LONG value only for insert into a LONG column  上网看了看大家的说法,原来是oracle版本稍微变了,但是和hibernate还有驱动不相容,所以插入中文就有错。也没怎么深究,不填中文就行了。这是不大问题,记一下,后面再改吧。其实换换驱动就可以解决了,[url=http://www.andingbeijing.com]安定北京[/url]但一时懒得去找了:)

 

2007-05-15 13:45:11,156 DEBUG [org.hibernate.SQL] - <insert into info_pub_article_type (description, icon, icon_open, is_open, parent_type_uuid, type_name, target, url, article_type_uuid) values (?, ?, ?, ?, ?, ?, ?, ?, ?)>
2007-05-15 13:45:11,187 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 1461, SQLState: 72000>
2007-05-15 13:45:11,187 ERROR [org.hibernate.util.JDBCExceptionReporter] - <ORA-01461: can bind a LONG value only for insert into a LONG column
>
2007-05-15 13:45:11,187 WARN [org.hibernate.util.JDBCExceptionReporter] - <SQL Error: 1461, SQLState: 72000>
2007-05-15 13:45:11,234 ERROR [org.hibernate.util.JDBCExceptionReporter] - <ORA-01461: can bind a LONG value only for insert into a LONG column
>
2007-05-15 13:45:11,234 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] - <Could not synchronize database state with session>
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:249)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
 at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
 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.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:388)
 at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:363)
 at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:676)
 at com.sitechasia.webx.core.dao.hibernate3.BaseHibernateDao.genericSave(BaseHibernateDao.java:277)
 at com.sitechasia.webx.core.dao.hibernate3.HibernateDomainObjectDao.doSave(HibernateDomainObjectDao.java:72)
 at com.sitechasia.xinnet.infopub.dao.impl.ArticleTypeDaoImpl.doSaveArticleType(ArticleTypeDaoImpl.java:45)
 at com.sitechasia.xinnet.infopub.test.TestArticletype.testAddArticleTypeByRandom(TestArticletype.java:76)
 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:585)
 at junit.framework.TestCase.runTest(TestCase.java:154)
 at junit.framework.TestCase.runBare(TestCase.java:127)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
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.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
 at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
 at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
 ... 28 more

安定北京

评论(2)

  1. #2 楼 · lin5061 · 2008-10-05 22:00

    数据库建立的时候选择UTF-8就行了

  2. #1 楼 · oboaix · 2008-06-01 20:04

    ?????兄弟有没解决了

评论功能维护中,当前仅展示历史评论。