I don't see a quick solution to get the entire string sent to the client, so I'm adding a patch that adds a java.sql.DataTruncation warning to the result instead for now.
The server adds warnings before the row data. However, we don't know until after we've tried writing the data whether we had to truncate any values. Because of this, I've changed the server code to save the position of the SQLCAGRP section in which the warnings are written, and if it detects that data was truncated, it goes back and overwrites it with the data truncation warnings later.
On the client side, some changes were needed for it to correctly deserialize a java.sql.DataTruncation object. It wouldn't break without these changes, but it would create an ordinary SQLWarning instead of DataTruncation. The DataTruncation object has fields so that the caller can find out exactly which column was truncated, and by how much.
Unfortunately, the server isn't capable of sending chained warnings yet, so in the case of multiple columns being truncated, we only get a warning for the first one. But that's another bug...
The patch also makes the test verify that the proper DataTruncation warnings are received, and a test case that verifies that it also works as expected with output parameters in stored procedures has been added.
All the regression tests ran cleanly with the patch.