1 Reply Latest reply on Sep 15, 2011 8:05 AM by mcatalin23

    working with String longer than 32766 chararacters

    mcatalin23

      Trying to put in the CLOB column (database oracle 10g) a string longer than 32766 chars gives following error:

       

      java.sql.SQLException: setString can only process strings of less than 32766 chararacters

       

      I have found following configuration on Tomcat to accept longer strings

      <Resource name="jdbc/OracleDs"   

           type="javax.sql.DataSource"

           auth="Container"/>

          

      <ResourceParams name="jdbc/OracleDs">

        <parameter>

              <name>url</name>

              <value>jdbc:oracle:thin:@server:1521:sid</value>

        </parameter>

        <parameter>

              <name>driverClassName</name>

              <value>oracle.jdbc.OracleDriver</value>

        </parameter>

        <parameter>

              <name>username</name>

              <value>user</value>

        </parameter>

        <parameter>

              <name>password</name>

              <value>password</value>

        </parameter>

        <parameter>

              <name>connectionProperties</name>

              <value>SetBigStringTryClob=true;</value>

        </parameter>

      </ResourceParams>

       

      Is any similar configuration on oracle-ds.xml file in Jboss AS 6?

      What should I add in this case into the datasource tag?

       

        <local-tx-datasource>

          <jndi-name>OracleDS</jndi-name>

          <connection-url>jdbc:oracle:thin:@<server>:1521:<u></connection-url>

          <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

          <user-name>user</user-name>

          <password>pwd</password>

          <max-pool-size>100</max-pool-size>

          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

        </local-tx-datasource>

        • 1. Re: working with String longer than 32766 chararacters
          mcatalin23

          I have found this configuration for oracle-ds.xml and it's working. I can use strings longer than 32766 characters:

           

           

          <local-tx-datasource>

               ...

                <!-- Tells an Oracle 10g driver to properly implement clobs. -->

               <connection-property name="SetBigStringTryClob">true</connection-property>

               ...

          </local-tx-datasource>

           

           

          This is how you can add connection properties to yorur jboss datasource.

          The properties will get passed in the DriverManager.getConnection(props) call.