ORA-12899: the value of column XX is too large (actual value: 521, maximum value: 512)

Source: Internet
Author: User
Tags sql error

When hibernate saves data to the oracle database, the following error is reported:

20:25:56, 593 WARN JDBCExceptionReporter: 100-SQL Error: 12899, SQLState: 7200020: 25: 56,593 ERROR JDBCExceptionReporter: 101-ORA-12899: column "ITS ". "VIO_BUSINESS_RESPONSE_ I ". the value of "RESPONSE" is too large (actual value: 521, maximum value: 512) 20:25:56, 593 WARN JDBCExceptionReporter: 100-SQL Error: 12899, SQLState: 7200020: 25: 56,593 ERROR JDBCExceptionReporter: 101-ORA-12899: column "ITS ". "VIO_BUSINESS_RESPONSE_ I ". the value of "RESPONSE" is too large (actual value: 521, maximum value: 512) 20:25:56, 593 ERROR occurred actflushingeventlistener: 324-cocould not synchronize database state with sessionorg. hibernate. queryTimeoutException: cocould not execute JDBC batch updateat org. hibernate. exception. SQLStateConverter. convert (SQLStateConverter. java: 124) at org. hibernate. exception. JDBCExceptionHelper. convert (JDBCExceptionHelper. java: 66) at org.hibernate.jdbc.AbstractBatcher.exe cuteBatch (AbstractBatcher. java: 275) at org.hibernate.engine.ActionQueue.exe cuteActions (ActionQueue. java: 262) at org.hibernate.engine.ActionQueue.exe cuteActions (ActionQueue. java: 178) at org. hibernate. event. def. abstractFlushingEventListener. extends mexecutions (AbstractFlushingEventListener. java: 321) at org. hibernate. event. def. defaultFlushEventListener. onFlush (defaflusheventlistener. java: 51) at org. hibernate. impl. sessionImpl. flush (SessionImpl. java: 1206) at org. hibernate. impl. sessionImpl. managedFlush (SessionImpl. java: 375) at org. hibernate. transaction. JDBCTransaction. commit (JDBCTransaction. java: 137) at org. springframework. orm. hibernate3.HibernateTransactionManager. doCommit (HibernateTransactionManager. java: 656) at org. springframework. transaction. support. abstractPlatformTransactionManager. processCommit (AbstractPlatformTransactionManager. java: 754) at org. springframework. transaction. support. abstractPlatformTransactionManager. commit (AbstractPlatformTransactionManager. java: 723) at org. springframework. transaction. intercentor. transactionAspectSupport. commitTransactionAfterReturning (TransactionAspectSupport. java: 393) at org. springframework. transaction. interceptor. transactionInterceptor. invoke (TransactionInterceptor. java: 120) at org. springframework. aop. framework. reflectiveMethodInvocation. proceed (ReflectiveMethodInvocation. java: 172) at org. springframework. aop. interceptor. exposeInvocationInterceptor. invoke (ExposeInvocationInterceptor. java: 90) at org. springframework. aop. framework. reflectiveMethodInvocation. proceed (ReflectiveMethodInvocation. java: 172) at org. springframework. aop. framework. jdkDynamicAopProxy. invoke (JdkDynamicAopProxy. java: 202) at $ Proxy45.queryObjectOut (Unknown Source) 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. apache. cxf. service. invoker. abstractInvoker. using minvocation (AbstractInvoker. java: 180) at org. apache. cxf. service. invoker. abstractInvoker. invoke (AbstractInvoker. java: 96) at org. apache. cxf. jaxws. abstractJAXWSMethodInvoker. invoke (AbstractJAXWSMethodInvoker. java: 178) at org. apache. cxf. jaxws. JAXWSMethodInvoker. invoke (JAXWSMethodInvoker. java: 68) at org. apache. cxf. service. invoker. abstractInvoker. invoke (AbstractInvoker. java: 75) at org. apache. cxf. interceptor. serviceInvokerInterceptor $ 1.run( ServiceInvokerInterceptor. java: 58) at java. util. concurrent. executors $ RunnableAdapter. call (Executors. java: 441) at java. util. concurrent. futureTask $ Sync. innerRun (FutureTask. java: 303) at java. util. concurrent. futureTask. run (FutureTask. java: 138) at org.apache.cxf.workqueue.SynchronousExecutor.exe cute (SynchronousExecutor. java: 37) at org. apache. cxf. interceptor. serviceInvokerInterceptor. handleMessage (ServiceInvokerInterceptor. java: 107) at org. apache. cxf. phase. phaseInterceptorChain. doIntercept (PhaseInterceptorChain. java: 272) at org. apache. cxf. transport. chainInitiationObserver. onMessage (ChainInitiationObserver. java: 121) at org. apache. cxf. transport. http. abstractHTTPDestination. invoke (maid. java: 239) at org. apache. cxf. transport. servlet. servletController. invokeDestination (ServletController. java: 248) at org. apache. cxf. transport. servlet. servletController. invoke (ServletController. java: 222) at org. apache. cxf. transport. servlet. servletController. invoke (ServletController. java: 153) at org. apache. cxf. transport. servlet. CXFNonSpringServlet. invoke (CXFNonSpringServlet. java: 167) at org. apache. cxf. transport. servlet. abstractHTTPServlet. handleRequest (AbstractHTTPServlet. java: 286) at org. apache. cxf. transport. servlet. abstractHTTPServlet. doPost (AbstractHTTPServlet. java: 206) at javax. servlet. http. httpServlet. service (HttpServlet. java: 637) at org. apache. cxf. transport. servlet. abstractHTTPServlet. service (AbstractHTTPServlet. java: 262) at org. apache. catalina. core. applicationFilterChain. internalDoFilter (ApplicationFilterChain. java: 290) at org. apache. catalina. core. applicationFilterChain. doFilter (ApplicationFilterChain. java: 206) at org. apache. catalina. core. standardWrapperValve. invoke (StandardWrapperValve. java: 233) at org. apache. catalina. core. standardContextValve. invoke (StandardContextValve. java: 191) at org. apache. catalina. core. standardHostValve. invoke (StandardHostValve. java: 127) at org. apache. catalina. valves. errorReportValve. invoke (ErrorReportValve. java: 102) at org. apache. catalina. core. standardEngineValve. invoke (StandardEngineValve. java: 109) at org. apache. catalina. connector. coyoteAdapter. service (CoyoteAdapter. java: 298) at org. apache. coyote. http11.Http11Processor. process (Http11Processor. java: 857) at org. apache. coyote. http11.Http11Protocol $ Http11ConnectionHandler. process (Http11Protocol. java: 588) at org.apache.tomcat.util.net. JIoEndpoint $ Worker. run (JIoEndpoint. java: 489) at java. lang. thread. run (Thread. java: 662) Caused by: java. SQL. batchUpdateException: ORA-12899: column "ITS ". "VIO_BUSINESS_RESPONSE_ I ". the value of "RESPONSE" is too large (actual value: 521, maximum value: 512) at oracle. jdbc. driver. databaseError. throwBatchUpdateException (DatabaseError. java: 343) at oracle.jdbc.driver.OraclePreparedStatement.exe cuteBatch (OraclePreparedStatement. java: 10656) at com.mchange.v2.c31_impl.newproxypreparedstatement.exe cuteBatch (NewProxyPreparedStatement. java: 1723) at org. hibernate. jdbc. batchingBatcher. doExecuteBatch (BatchingBatcher. java: 70) at org.hibernate.jdbc.AbstractBatcher.exe cuteBatch (AbstractBatcher. java: 268 )... 55 more

Q: Why is the actual value 0,512 clearly added as a subString (521) to the string to be inserted ,?

A: This is because the string to be inserted contains Chinese characters. The Chinese Character occupies one position in subString, but there are more than one position in the database.

Solution: 1. Try to cut as few points as possible for the inserted string, such as subString (0,400)

2. encode the inserted string before intercepting it, such as Urlencoder. encode (str, "UTF-8"). In this way, subString (0,512) is correct.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.