title: Java exception: the statement didn't return a resultset
body: <p>My original environment is <strong>SQL server 2005 + WebSphere v6.0(JDBC 3.0)</strong>. When I run the program as below and it works well.</p>
  
  <pre><code>ResultSet rs=stmt.executeQuery(sql);
  rs.next();
  </code></pre>
  
  <p>However, when I upgrade the environment to <strong>SQL server 2005 + WebSphere v8.5(JDBC 4.0)</strong>, I get the error message: </p>
  
  <blockquote>
    <p>com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not
    return a result set.</p>
  </blockquote>
  
  <p>From this forum's information, it seems that I have multiple resultsets, so I try to change the program as follows and it works fine.</p>
  
  <pre><code>stmt.execute(sql);
  stmt.getMoreResults();
  stmt.getMoreResults();
  ResultSet rs=stmt.getResultSet();
  rs.next();
  </code></pre>
  
  <p>My questions is that is there any approach that I can keep my program unchanged and works well with <code>JDBC 4.0 driver(WAS v8.5)</code> or any combination like <code>SQL svr 2000 + WAS v8.5</code>, etc.</p>
  
  <p>Please give me any pointer and your recommendation is valuable to me, thank you.</p>
  
  <p>Ann</p>