ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yee, Richard K CTR DMDC" <Richard.Yee....@osd.pentagon.mil>
Subject RE: [JDBC type = ARRAY / Java type = ?] ORA-01461: can bind a LON G value only for insert into a LONG column
Date Mon, 05 Mar 2007 18:57:43 GMT
Francesco,
It may even perform better since the JDBC driver doesn't need to send as
much data. What version of Oracle are you using?

-Richard

-----Original Message-----
From: francesco77 [mailto:f.bonavia@reply.it] 
Sent: Monday, March 05, 2007 9:45 AM
To: user-java@ibatis.apache.org
Subject: 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(Ge
neralStatement.java:91)
>>      [java] at
>>
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDe
legate.java:447)
>>      [java] at
>>
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.jav
a:82)
>>      [java] at
>>
org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(SqlMa
pClientTemplate.java:369)
>>      [java] at
>>
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemp
late.java:193)
>>      [java] at
>>
org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTempl
ate.java:367)
>>      [java] at
>>
com.fiat.mida.model.productservice.dao.ProductServiceListDao.insertString300
(ProductServiceListDao.java:222)
>>      [java] at
>>
com.fiat.mida.model.productservice.dao.ProductServiceListDao$$FastClassByCGL
IB$$3e35f499.invoke(<generated>)
>>      [java] at
>> net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
>>      [java] at
>>
org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invok
eJoinpoint(Cglib2AopProxy.java:675)
>>      [java] at
>>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflect
iveMethodInvocation.java:154)
>>      [java] at
>>
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Tr
ansactionInterceptor.java:107)
>>      [java] at
>>
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflect
iveMethodInvocation.java:176)
>>      [java] at
>>
org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInter
ceptor.intercept(Cglib2AopProxy.java:568)
>>      [java] at
>>
com.fiat.mida.model.productservice.dao.ProductServiceListDao$$EnhancerByCGLI
B$$5fd0b54d.insertString300(<generated>)
>>      [java] at
>>
com.fiat.mida.model.productservice.logic.ProductServiceListService.insertStr
inga300(ProductServiceListService.java:82)
>>      [java] at
>>
com.fiat.mida.controller.productservice.ProductServiceInfoDetailAction.inser
tStringa300(ProductServiceInfoDetailAction.java:227)
>>      [java] at
>>
com.fiat.mida.controller.productservice.ProductServiceInfoDetailAction.delet
e(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(AbstractExecu
teAction.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:30
4)
>>      [java] at
>> org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>>      [java] at
>>
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequest
Processor.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.ja
va:65)
>>      [java] at
>>
com.fiat.mida.controller.security.AuthorizationFilter.doFilter(Authorization
Filter.java:117)
>>      [java] at
>>
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.ja
va:16)
>>      [java] at
>>
org.springframework.web.filter.RequestContextFilter.doFilterInternal(Request
ContextFilter.java:61)
>>      [java] at
>>
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestF
ilter.java:77)
>>      [java] at
>>
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa
tcher.java:659)
>>      [java] at
>>
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq
uestDispatcher.java:330)
>>      [java] at
>>
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle
r.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(ReleasableRe
sourcePooledExecutor.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:18
1)
>>      [java] at
>>
oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatemen
t.java:629)
>>      [java] at
>>
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
:1153)
>>      [java] at
>>
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedSta
tement.java:2932)
>>      [java] at
>>
oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.j
ava:3023)
>>      [java] at
>>
com.evermind.sql.FilterPreparedStatement.execute(FilterPreparedStatement.jav
a:255)
>>      [java] at
>>
com.evermind.sql.FilterPreparedStatement.execute(FilterPreparedStatement.jav
a:255)
>>      [java] at
>>
com.evermind.sql.PreparedStatementBCELProxy.execute(PreparedStatementBCELPro
xy.java:363)
>>      [java] at
>>
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.jav
a:81)
>>      [java] at
>>
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate
(GeneralStatement.java:200)
>>      [java] at
>>
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(Ge
neralStatement.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-int
o-a-LONG-column-tf3349166.html#a9316541
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

Mime
View raw message