Announcement Announcement Module
No announcement yet.
Using the OracleLobHandler to insert a clob Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using the OracleLobHandler to insert a clob

    I am using the OracleLobHandler provided by Spring to insert a clob into the database, but got a IOException:Connection aborted by peer: socket write error
    I am using struts1.2 hibernate 2.1.7 spring 1.1.2 oracle9. and wsad5.1
    Here is my applicationContext.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">
    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
    <property name="dataSource">
    <ref local="dataSource"/>
    <property name="mappingResources">
    <property name="hibernateProperties">
    <prop key="hibernate.dialect">
    <prop key="hibernate.query.substitutions">true=1 false=0</prop>
    <property name="lobHandler">
    <bean class=" LobHandler">
    <property name="nativeJdbcExtractor">
    <bean class=" .WebSphereNativeJdbcExtractor"/>
    <bean id="transactionManager" class="org.springframework.orm.hibernate.Hibernate TransactionManager">
    <property name="sessionFactory">
    <ref local="sessionFactory"/>
    <bean id="userDAO" class="com.ssh.dao.hibernate.UserHibernateDAO">
    <property name="sessionFactory">
    <ref local="sessionFactory"/>
    <bean id="userManager" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager">
    <ref local="transactionManager"/>
    <property name="target">
    <bean class="com.ssh.service.impl.UserManagerImpl">
    <property name="userDAO">
    <ref local="userDAO"/>
    <property name="transactionAttributes">
    <prop key="save*">PROPAGATION_REQUIRED</prop>
    <prop key="remove*">PROPAGATION_REQUIRED</prop>
    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>

    My struts-config.xml is:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    <form-bean name="userForm" type="com.ssh.web.form.UserForm"/>
    <action name="userForm" scope="request" path="/user" type="org.springframework.web.struts.DelegatingAct ionProxy" parameter="method">
    <forward name="success" path="/index.jsp"/>
    <message-resources parameter="ssh.resources.ApplicationResources"/>
    <plug-in className="org.springframework.web.struts.ContextL oaderPlugIn">
    <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml,/WEB-INF/action-servlet.xml"/>

    My action-servlet.xml is:
    <?xml version="1.0" encoding="UTF-8"?>
    <bean name="/user" class="com.ssh.web.action.UserAction" singleton="false">
    <property name="userManager">
    <ref bean="userManager"/>

    My Users.hbm.xml is:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
    <class name="com.ssh.dao.model.User" table="USERS">
    <id name="id" type="string" unsaved-value="null">
    <column name="USERID"/>
    <generator class="uuid.hex"/>
    <property name="userName" />
    <property name="password" />
    <property name="describe" type=" obStringType"/>

    My is:
    public class User {
    private String id = null;
    private String userName = null;
    private String password = null;
    private String describe= null;

    // Set Get methods

    Then in my , I use getHibernateTemplate().saveOrUpdate(user) to store the user object into the database

    When I save the user object without set the describe property,it works very well, however, if I set the describe property(even only one character), it dosen't work, here is the exception stack:
    java.sql.SQLException:No more data to read from socket
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.j ava:1160)
    at oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine. java:963)
    at oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine. java:893)
    at oracle.jdbc.ttc7.Oall7.receive(
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol .java:1891)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TT
    at oracle.jdbc.driver.OracleStatement.executeNonQuery (
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(
    at oracle.jdbc.driver.OraclePreparedStatement.execute Update(
    at executeUpdate(
    at net.sf.hibernate.impl.NonBatchingBatcher.addToBatc h(
    at net.sf.hibernate.persister.EntityPersister.insert(
    at net.sf.hibernate.persister.EntityPersister.insert(
    at net.sf.hibernate.impl.ScheduledInsertion.execute(S
    at net.sf.hibernate.impl.SessionImpl.executeAll(Sessi
    at net.sf.hibernate.impl.SessionImpl.execute(SessionI
    at net.sf.hibernate.impl.SessionImpl.flush(SessionImp
    at net.sf.hibernate.transaction.JDBCTransaction.commi t(
    at org.springframework.orm.hibernate.HibernateTransac tionManager.doCommit(HibernateTransactionManager.j ava:464)
    at atformTransactionManager.commit(AbstractPlatformTr
    at org.springframework.transaction.interceptor.Transa ctionAspectSupport.doCommitTransactionAfterReturni ng(
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:66)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed( :143)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(
    at $Proxy0.saveOrUpdateUser(Unknown Source)
    at com.ssh.web.action.UserAction.add( 64)

    It will be great if someone can tell me what excatly should I do to solve the problem.
    Thanks in Advance.

  • #2
    Didn't you get a specific Oracle error number (ORA-XXXXX)?


    • #3
      Yes, the ErrorCode is 17,410 and SQLState is <null>


      • #4
        This is a problem related to Oracle, it has nothing to do with Spring. People have solved this problem by upgrading to the latest 9i thin drivers or upgrading to Oracle Don't take this advise for granted, changing your driver or upgrading your database may not go without consequences! Also, applying any of these two solutions may not solve your problem at all yet may introduce a whole new set of problems. Check with your DBA.


        • #5
          tentacle, thank you very much! I have upgraded to the latest 9i thin drivers(, and solved the problem. But I don't know whether there will new set of problems be appear


          • #6
            tentacle, thank you very much!
            No problem, you owe me a beer

            I have upgraded to the latest 9i thin drivers(, and solved the problem. But I don't know whether there will new set of problems be appear
            Probably not, I just wanted you to think about what you're doing. An Oracle database has a mind of its own, changing _anything_ _can_ lead to disaster. Changing your driver may introduce other subtle bugs but if it solves your current problem that's already that.


            • #7
              There's been recent talk about this in the Hibernate forum, too. I'll mention here what I did there: The Oracle 10 driver seems to handle CLOBs of any size correctly without custom UserTypes or special support from Spring. It works fine for Oracle 9i databases, as well. Although batching must be disabled in Hibernate.