title: Retrieving a max date from DB2 in Java throwing wrong column type conversion exception
body: <p>I have the following SQL that returns the max BILL_DATE based on some criteria. BILL_DATE is defined in the database as a DATE.</p>
  
  <pre><code>SELECT MAX(BILL_DATE)
  FROM BILLTABLE
  WHERE col1 = ? and
        col2 = ?
  </code></pre>
  
  <p>But when I read the value from the resultSet.</p>
  
  <pre><code>bill.setBillDate(resultSet.getDate(1));
  </code></pre>
  
  <p>An exception is thrown:</p>
  
  <blockquote>Invalid data conversion: Wrong result column type for requested conversion. ERRORCODE=-4461, SQLSTATE=42815</blockquote>
  
  <p>I have also tried</p>
  
  <pre><code>bill.setBillDate(resultSet.getString(1));
  </code></pre>
  
  <p>But that doesn't return a date. It returns either <code>100</code>, <code>200</code> or <code>300</code> which is obviously not correct.</p>
  
  <p>Is there another way to do this? Am I doing something wrong?</p>