title: Get the SQLException java.sql.SQLException: ResultSet.next was not called
body: <p>I'm developing a Webservice at the moment. I thought I was ready to release my first productive version but I keep getting a SQLException which doesn't make any sense to me. I'm developing against a Oracle db btw. 
  Let me give you my code at first: </p>
  
  <pre><code>try{
      variable = DoQuery("SELECT KEY FROM TABLE WHERE KEY IN ('KEY1', 'KEY2') AND ROWNUM = 1").getString("HANDLE");
  }catch(SQLException e){
      return "Wasn't able to gather key: " + e.toString() + " - " + e.getSQLState();
  }
  </code></pre>
  
  <p>The method "DoQuery":</p>
  
  <pre><code>private ResultSet DoQuery(String sqlString){
      Statement sqlHandleStatement;
      try {
          sqlHandleStatement = getStatement();
          return sqlHandleStatement.executeQuery(sqlString);
      } catch (SQLException e) {
          e.printStackTrace();
      }
      return null;
  }
  </code></pre>
  
  <p>The method "getStatement":</p>
  
  <pre><code>private Statement getStatement() throws SQLException {
      DataSource dataSource = null;
      try {
          dataSource = (DataSource) JNDIUtils.getInitialContext().lookup(JNDIUtils.DEFAULT_DATASOURCE);
      } catch (NamingException e) {
          e.printStackTrace();
      }
      Connection connection;
  
      connection = dataSource.getConnection();
      Statement statement;
      statement = connection.createStatement();
      return statement;
  }   
  </code></pre>
  
  <p>However if I execute my SOAP request I keep getting back: </p>
  
  <pre><code>&lt;SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
     &lt;SOAP-ENV:Body&gt;
        &lt;ns2:getNextRMANumberResponse xmlns:ns2="http://webservice.epm.com/"&gt;
           &lt;return&gt;Wasn't able to gather key: java.sql.SQLException: ResultSet.next was not called - 99999&lt;/return&gt;
        &lt;/ns2:getNextRMANumberResponse&gt;
     &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>Error message: "Wasn't able to gather key: java.sql.SQLException: ResultSet.next was not called - 99999" (compare to the very first code snippet given in this post)</p>
  
  <p>What does this mean? I really don't get why I should execute "ResultSet.next"?! </p>
  
  <p>Thanks in advance!</p>