5 Replies Latest reply on Nov 7, 2015 1:03 PM by Steven Hawkins

    return a string of length more than 4000

    Prashanthi Kairuppala Novice

      Hi,

       

      I need to return a variable of length more than 4000. i had the datatype as string but it is not returning the complete string.

      what should be the datatype of the column if i need to return a readable string with length more than 4000?

       

      Thanks in advance,

      Prashanthi.

        • 1. Re: return a string of length more than 4000
          Ramesh Reddy Master

          You can increase the default max length of the string using "maxStringLength" system property System Properties - Teiid 9.0 (draft) - Project Documentation Editor

           

          However, note that this will increases the overall system memory consumption, if possible try to use CLOB as the datatype. However, you would need to read and convert to string in your client application.

          • 2. Re: return a string of length more than 4000
            Prashanthi Kairuppala Novice

            Hi Ramesh,

             

            Thanks for the note, but should it not be the case the CLOBs are not limited by the string max value. Something like what is mentioned in the link Apache Olingo Library

            We configure columns to be CLOB where default string restrictions are not sufficient to hold the value.

             

            The ODATA translator also strips the string to 4000 characters.

             

            We would have to increase the property of the string, but I assume that this would be the max length and not a scenario where for every string that much of memory is set. Additionally we are on Java 7 where the string pool is in heap so it can be gc'd if there is no application reference to the string. Can you let us know if the Strings that are output through Odata are not held as referenced in the memory so that GC can pick them up.

             

            A reply will be helpful.

             

            Thanks

            • 3. Re: return a string of length more than 4000
              Ramesh Reddy Master

              Prashanthi,

              but should it not be the case the CLOBs are not limited by the string max value.

              CLOBs are not limited by sting max size.

               

              Yes, you are right currently the Clobs, SQLXML are mapped to String in OData. The only other option I see is what I said originally to map to VARBINARY in Teiid, that gets converted to BINARY and I do not know of any truncation there, but the clients must deal with converting them back string. Or there is an argument can be made that, CLOBs are being truncated, that can be considered a bug? You can open a JIRA then we can weigh the options. As string, what we have is correct.

               

              As per the cache pool, by default the results are cached for 5 mins. Which you can change through modifying the web.xml of OData WAR file. If you do not want caching at all, you can either set "batch-size" property in the web.xml to "0", that means there is no more paging, and all the records will be delivered in one payload. However, if do not know your resultset sizes are small, that could be leading to OOM issues.  Again, here an enhancement request can be made to "turn off" the caching. Note that *if* we do this, every time we you ask for next page of results, the query is executed again (performance), if the results have changed in-between in-consistent results are possible.

               

              OData V4 provides a "Edm.Stream" to deal with stream types, and Teiid maps CLOB/SQLXML and BLOB to Edm.Stream.

               

              Thanks


              Ramesh..

              • 4. Re: return a string of length more than 4000
                Prashanthi Kairuppala Novice

                Hi Ramesh,

                 

                thanks for the reply.

                We tried with CLOB datatype but we still got only 4000 length limited string.

                 

                We also tried adding the below line in standalone.conf file in bin folder and restarted the server, but no luck. is this the correct line we have added?

                JAVA_OPTS="$JAVA_OPTS -Dorg.teiid.maxStringLength=8000"

                 

                Thanks.

                • 5. Re: return a string of length more than 4000
                  Steven Hawkins Master

                  > We tried with CLOB datatype but we still got only 4000 length limited string.

                   

                  It may be good to determine where the truncation is occurring - for example if you make a similar query over JDBC outside of the OData layer can you verify that the value is already truncated?

                   

                  I would expect the standalone.conf to work, but you can also modify the relevant config xml - http://stackoverflow.com/questions/14586657/system-properties-in-standalone-full-xml