Java seems to be truncating long string result from MS-SQL query
So I've got a query in a JSP class that retrieves, basically, the entire contents of a table as a string using MS SQL's "FOR XML AUTO" feature.
I.e., select * from userdata for xml auto
.
The problem is that the result is being truncated at around 2033 characters. There's no unusual character at that point or anything; the break occurs right in the middle of a plain-text attribute.
Is there some obvious thing that's likely causing this, like a limi开发者_开发技巧t parameter I need to increase somewhere?
Thanks.
How are you reading in the result?
If you're using ResultSet.getString() I would first try replacing that with ResultSet.getBinaryInput() or getCharacterStream(), then make sure you read in the contents fully before closing the stream.
That's a much better way to do it, in case you end up with a giant data set you won't need to keep the whole thing in memory (especially if you use SAX to pick out the information you need, rather then building a DOM tree)
精彩评论