You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by francesco77 <f....@reply.it> on 2007/03/05 18:44:41 UTC

Re: [JDBC type = ARRAY / Java type = ?] ORA-01461: can bind a LONG value only for insert into a LONG column

Richard,

I solved the problem using the substring of java instead the substr of
Oracle.

But, for me, this is a workaround, because the all string of 1800 characters
was a VARCHAR2 TYPE in ORACLE, and also the SUBSTR is a VARCHAR2 TYPE. 
Infact if I do this statement on my DB:

insert into testbonavia values (stringa, substr(stringa,200,400)) 

it is all ok and the row is inserted.
The problem is when the SUBSTR was used by I-BATIS, in my opinion.

Anyway, thanks a lot for the tip

Francesco


Richard Yee wrote:
> 
> Francesco,
> Check your DB documentation on the return type of SUBSTR when using a 
> Long argument. I think you will find that it returns a Long. This isn't 
> an iBATIS issue.
> 
> One solution may be to do the SUBSTR using Java instead of the DB.
> 
> You might also consider using a Pojo instead of a Map. I think you will 
> get better performance from iBATIS.
> 
> -Richard
> 
> 
> francesco77 wrote:
>> I have this error when I try to insert a record into this table:
>>
>> CREATE TABLE TESTBONAVIA
>> (
>>   QUERY  CHAR(2000 CHAR),
>>   UNO    CHAR(200 CHAR)
>> );
>>
>> Then I have the xml insert like this:
>>
>> <insert id="provaInsert">
>>     	insert into testbonavia(query,uno)
>>     	values (#stringa300#,SUBSTR(#stringa300#,1,100) )
>> </insert>
>>
>> And the DAO which use this insert statement is :
>>
>> public void insertStringTot(String stringa300) {
>>     	Map messageKey = (Map) messageKeyOfThread.get();
>>     	messageKey.put("stringa300", stringa300);
>>     	getSqlMapClientTemplate().insert("ProductServiceQuery.provaInsert",
>> messageKey);
>>     }
>>
>> If I have the string which is this :
>>
>> *000MURF-SIGI-CDV-SAVA            TR-300                       
>> 2007030539960892MODOWN00    200703050D4PAB    H3C43054                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
>> CD282LV                                                                                                                                                                                                           
>> 04                                                                                                                                                                                                                                                                                                                     
>> 20030129                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
>> D                                         *
>>
>> The * are used only to delimitate the string and there are NOT part of
>> the
>> string!!!!
>>
>> If I try to execute the DAO insert it fails with this error :
>>
>> [15:12:28 ERROR]
>> com.fiat.mida.controller.common.UnexpectedExceptionHandler.execute(34) -
>> unexpected exception [userid=ubonavia,locale=it_IT] is:
>>      [java] org.springframework.jdbc.UncategorizedSQLException:
>> SqlMapClient
>> operation; uncategorized SQLException for SQL []; SQL state [72000];
>> error
>> code [1461];
>>      [java] --- The error occurred in
>> com/fiat/mida/model/productservice/dao/ProductService.xml.
>>      [java] --- The error occurred while applying a parameter map.
>>      [java] --- Check the
>> ProductServiceQuery.provaInsert-InlineParameterMap.
>>      [java] --- Check the statement (update failed).
>>      [java] --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG
>> value only for insert into a LONG column
>>      [java] ORA-02063: preceding line from DLHZ7LINK1000
>>      [java] ; nested exception is
>> com.ibatis.common.jdbc.exception.NestedSQLException:
>>      [java] --- The error occurred in
>> com/fiat/mida/model/productservice/dao/ProductService.xml.
>>      [java] --- The error occurred while applying a parameter map.
>>      [java] --- Check the
>> ProductServiceQuery.provaInsert-InlineParameterMap.
>>      [java] --- Check the statement (update failed).
>>      [java] --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG
>> value only for insert into a LONG column
>>      [java] ORA-02063: preceding line from DLHZ7LINK1000
>>      [java] Caused by:
>>      [java] com.ibatis.common.jdbc.exception.NestedSQLException:
>>      [java] --- The error occurred in
>> com/fiat/mida/model/productservice/dao/ProductService.xml.
>>      [java] --- The error occurred while applying a parameter map.
>>      [java] --- Check the
>> ProductServiceQuery.provaInsert-InlineParameterMap.
>>      [java] --- Check the statement (update failed).
>>      [java] --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG
>> value only for insert into a LONG column
>>      [java] ORA-02063: preceding line from DLHZ7LINK1000
>>      [java] at
>> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
>>      [java] at
>> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
>>      [java] at
>> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
>>      [java] at
>> org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(SqlMapClientTemplate.java:369)
>>      [java] at
>> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
>>      [java] at
>> org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:367)
>>      [java] at
>> com.fiat.mida.model.productservice.dao.ProductServiceListDao.insertString300(ProductServiceListDao.java:222)
>>      [java] at
>> com.fiat.mida.model.productservice.dao.ProductServiceListDao$$FastClassByCGLIB$$3e35f499.invoke(<generated>)
>>      [java] at
>> net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
>>      [java] at
>> org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:675)
>>      [java] at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
>>      [java] at
>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
>>      [java] at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
>>      [java] at
>> org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:568)
>>      [java] at
>> com.fiat.mida.model.productservice.dao.ProductServiceListDao$$EnhancerByCGLIB$$5fd0b54d.insertString300(<generated>)
>>      [java] at
>> com.fiat.mida.model.productservice.logic.ProductServiceListService.insertStringa300(ProductServiceListService.java:82)
>>      [java] at
>> com.fiat.mida.controller.productservice.ProductServiceInfoDetailAction.insertStringa300(ProductServiceInfoDetailAction.java:227)
>>      [java] at
>> com.fiat.mida.controller.productservice.ProductServiceInfoDetailAction.delete(ProductServiceInfoDetailAction.java:106)
>>      [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>      [java] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>      [java] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>      [java] at java.lang.reflect.Method.invoke(Method.java:324)
>>      [java] at
>> org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:266)
>>      [java] at
>> org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:167)
>>      [java] at
>> org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:143)
>>      [java] at
>> org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
>>      [java] at
>> org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
>>      [java] at
>> org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
>>      [java] at
>> org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>>      [java] at
>> org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
>>      [java] at
>> org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>>      [java] at
>> org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
>>      [java] at
>> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
>>      [java] at
>> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
>>      [java] at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>>      [java] at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>>      [java] at
>> com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
>>      [java] at
>> com.fiat.mida.controller.security.AuthorizationFilter.doFilter(AuthorizationFilter.java:117)
>>      [java] at
>> com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
>>      [java] at
>> org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:61)
>>      [java] at
>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
>>      [java] at
>> com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
>>      [java] at
>> com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
>>      [java] at
>> com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
>>      [java] at
>> com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
>>      [java] at
>> com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
>>      [java] at
>> com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
>>      [java] at java.lang.Thread.run(Thread.java:534)
>>      [java] Caused by: java.sql.SQLException: ORA-01461: can bind a LONG
>> value only for insert into a LONG column
>>      [java] ORA-02063: preceding line from DLHZ7LINK1000
>>      [java] at
>> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
>>      [java] at
>> oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
>>      [java] at
>> oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
>>      [java] at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:625)
>>      [java] at
>> oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
>>      [java] at
>> oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:629)
>>      [java] at
>> oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1153)
>>      [java] at
>> oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2932)
>>      [java] at
>> oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3023)
>>      [java] at
>> com.evermind.sql.FilterPreparedStatement.execute(FilterPreparedStatement.java:255)
>>      [java] at
>> com.evermind.sql.FilterPreparedStatement.execute(FilterPreparedStatement.java:255)
>>      [java] at
>> com.evermind.sql.PreparedStatementBCELProxy.execute(PreparedStatementBCELProxy.java:363)
>>      [java] at
>> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:81)
>>      [java] at
>> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
>>      [java] at
>> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
>>      [java] ... 47 more
>>      [java] [15:12:28 WARN]
>> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -  
>> Resource
>> org/apache/struts/action/LocalStrings_en_US.properties Not Found.
>>      [java] [15:12:28 WARN]
>> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -  
>> Resource
>> org/apache/struts/action/LocalStrings_en.properties Not Found.
>>      [java] [15:12:28 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.header) not found: search in properties file
>>      [java] [15:12:28 WARN]
>> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -  
>> Resource
>> com/fiat/mida/support/struts/MessageResources_it_IT.properties Not Found.
>>      [java] [15:12:28 WARN]
>> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -  
>> Resource
>> com/fiat/mida/support/struts/MessageResources_it.properties Not Found.
>>      [java] [15:12:28 WARN]
>> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -  
>> Resource
>> com/fiat/mida/support/struts/MessageResources_en_US.properties Not Found.
>>      [java] [15:12:28 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.footer) not found: search in properties file
>>      [java] [15:12:28 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.prefix) not found: search in properties file
>>      [java] [15:12:28 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.suffix) not found: search in properties file
>>      [java] [15:12:28 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.header) not found: search in properties file
>>      [java] [15:12:28 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.prefix) not found: search in properties file
>>      [java] [15:12:28 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(85) -
>> key(errors.unexpected) not found: search in properties file
>>      [java] [15:12:29 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.unexpected) not found: search in properties file
>>      [java] [15:12:29 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.suffix) not found: search in properties file
>>      [java] [15:12:29 DEBUG]
>> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
>> key(errors.footer) not found: search in properties file
>>
>> I'm in difficulty to understand this error.
>> I need a big HELP from someone,
>>
>> Thanks a lot
>> Francesco
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ORA-01461%3A-can-bind-a-LONG-value-only-for-insert-into-a-LONG-column-tf3349166.html#a9316541
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: [JDBC type = ARRAY / Java type = ?] ORA-01461: can bind a LONG value only for insert into a LONG column

Posted by Fabio Insaccanebbia <fi...@gmail.com>.
> francesco77 wrote:
> The problem is when the SUBSTR was used by I-BATIS, in my opinion.

Hi Francesco,
if you have the time, try making a test case with "pure jdbc" in your
environment: I think you'll see this problem happening again.

In my opinion there could be a problem with JDBC Driver and Dblink
(are you able to replicate it with "not dblinked" tables?).
There is a bug (2998709) in the Metalink Oracle Knowledge Base that
describes a similar issue with version 9.2.0.3.0: it also says that it
occurs only with OCI driver and not with Thin driver.

Bye,
Fabio