title: java.sql.ResultSet.getString() returns string with extra characters
body: <p>I recently encountered a problem with trying to retrieve a <strong>CLOB</strong> value from <strong>Oracle DB</strong> with <strong>Java</strong>. There is a table that stores XML files as <strong>CLOB</strong>. <code>NLS_CHARACTERSET</code> is set to <code>AL32UTF8</code>. 
  If I try to retrieve a value with <code>java.sql</code> package and using <code>ResultSet.getClob().getAsciiStream()</code> which then converts to the String with <code>UTF-8</code> encoding, then I get a valid XML. </p>
  
  <p>But if I use <strong><code>ResultSet.getString()</code></strong>, XML parser fails with parsing exception.  </p>
  
  <p>While debugging, the extracted value looks like <a href="https://i.stack.imgur.com/r3rpf.jpg" rel="nofollow noreferrer">this</a>. And it contains only half of the file.</p>
  
  <p>Others XML files can be selected with <strong><code>ResultSet.getString()</code></strong> with no problem.<br>
  I didn't see any noticeable difference in ASCII representation of corrupted and valid XML.<br>
  Problem is fixed when you re-insert the same value to the database.</p>
  
  <p>Can you please explain this behaviour of <strong><code>ResultSet.getString()</code></strong> method? </p>
  
  <p><strong>Information about Oracle</strong></p>
  
  <pre><code>Oracle version is 12.1.0.2.0.  
  </code></pre>
  
  <p><strong>Information about JDK:</strong></p>
  
  <pre><code>java version "1.7.0_131"  
  OpenJDK Runtime Environment (rhel-2.6.9.0.0.1.el7_3-x86_64 u131-b00)  
  OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)
  </code></pre>