title: DB2 SqlException: SQL passed with no tokens (Error Code -4462)
body: <p>Trying to use <code>prepareStatement</code> on a query from an XML file:</p>
  
  <pre><code>&lt;sql&gt;&lt;![CDATA[
    select MY_COLUMN from MY_TABLE where OTHER_COLUMN = ? 
  ]]&gt;
  &lt;/sql&gt;
  </code></pre>
  
  <p>But I get this exception:</p>
  
  <pre><code>com.ibm.db2.jcc.am.SqlException: [jcc][t4][10234][10927][3.59.81] SQL passed with no tokens. ERRORCODE=-4462, SQLSTATE=null
          at com.ibm.db2.jcc.am.dd.a(dd.java:660)
          at com.ibm.db2.jcc.am.dd.a(dd.java:60)
          at com.ibm.db2.jcc.am.dd.a(dd.java:120)
          at com.ibm.db2.jcc.am.jb.v(jb.java:7334)
          at com.ibm.db2.jcc.am.jb.a(jb.java:2124)
          at com.ibm.db2.jcc.am.jb.prepareStatement(jb.java:754)
  </code></pre>
  
  <p>I read that this is because the SQL is not in a single line. Is that the cause?</p>
  
  <p>I also read that in IBM Portal, you have to change <code>db2_zos.DbDriverType</code> from 2 to 4. But I think it's irrelevant to me as I don't use IBM Portal.</p>
  
  <p>Nothing else useful turned up from Google. I would love to know the real cause of the error, and to find an easier fix than forcing all SQL to single line.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>ArrayList arrList = new ArrayList();
  
  String sSQL = queryManager.getSQL("QRY001");
  
  Connection conn = null;
  PreparedStatement ps = null;
  ResultSet rs = null;
  try {
    conn = getConnection(); //a connection pool wrapper for java.sql.DriverManager.getConnection(...)
    ps = conn.prepareStatement(sSQL); // **** EXCEPTION OCCURS HERE
  
    ps.setInt(1, Integer.parseInt(otherColumn));
    rs = ps.executeQuery();
    while (rs.next())
    {
      arrList.add(rs.getString(1));
    }
  } catch (Exception e) {
    e.printStackTrace();
    throw new OEException(e);
  } finally {
    try {
      if (rs != null) {
        rs.close();
      }
      if (ps != null) {
        ps.close();
      }
      releaseConnection(conn);
    } catch (Exception e) {
      throw new CustomException(e);
    }
  }
  return arrList;
  </code></pre>