title: NullPointerException at while(rs.next())
body: <p>I have a simple program that executes a query agains a Sybase ASE DB using jconnect6 .
  the program throws a NullPointerException after iterating for 603 records of the ResultSet</p>
  
  <pre><code>   public ResultSet exec()
  {
  
          ResultSet rs = null;
      try {
          stmt= connection.createStatement();
          rs = stmt.executeQuery(query);
      } catch (SQLException ex) {
          ex.printStackTrace();
      }
      try {
          connection.close();
      } catch (SQLException ex) {
         ex.printStackTrace();
      }
          return rs;
  }
  
  
  public void Test()
  {
      ResultSet rs= exec();
      if(rs!=null)
      {
          int i=0;
          try {
              while(rs!=null &amp;&amp; rs.next()) {   // NullPointerException here
                  System.out.println(i++);
              }
          } catch (Exception ex) {
              ex.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>The output prints the value for 'i' till it reaches 603 while the collected records are more than 1000 and below is the error</p>
  
  <pre><code>May 13, 2014 11:43:43 AM appcomponents.OutageTest Test
  SEVERE: null
  java.lang.NullPointerException
  at com.sybase.jdbc3.timedio.RawDbio.reallyRead(Unknown Source)
  at com.sybase.jdbc3.timedio.Dbio.doRead(Unknown Source)
  at com.sybase.jdbc3.timedio.InStreamMgr.a(Unknown Source)
  at com.sybase.jdbc3.timedio.InStreamMgr.doRead(Unknown Source)
  at com.sybase.jdbc3.tds.TdsProtocolContext.getChunk(Unknown Source)
  at com.sybase.jdbc3.tds.PduInputFormatter.a(Unknown Source)
  at com.sybase.jdbc3.tds.PduInputFormatter.read(Unknown Source)
  at com.sybase.jdbc3.tds.TdsInputStream.read(Unknown Source)
  at com.sybase.jdbc3.tds.TdsInputStream.readInt(Unknown Source)
  at com.sybase.jdbc3.tds.TdsDataObject.readINTN(Unknown Source)
  at com.sybase.jdbc3.tds.TdsInt.beginRead(Unknown Source)
  at com.sybase.jdbc3.tds.TdsDataObject.doRead(Unknown Source)
  at com.sybase.jdbc3.tds.TdsInt.getLong(Unknown Source)
  at com.sybase.jdbc3.tds.CachedTdsInt.&lt;init&gt;(Unknown Source)
  at com.sybase.jdbc3.tds.TdsInt.createCachedCopy(Unknown Source)
  at com.sybase.jdbc3.tds.TdsResultSet.cacheCurrentRow(Unknown Source)
  at com.sybase.jdbc3.tds.TdsResultSet.next(Unknown Source)
  at com.sybase.jdbc3.jdbc.SybResultSet.next(Unknown Source)
  at appcomponents.OutageTest.Test(OutageTest.java:143)
  </code></pre>