title: java.sql.SQLException:[Microsoft][ODBC Driver Manager] Invalid descriptor index
body: <p>I use the following code</p>
  
  <pre><code>try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection con = DriverManager.getConnection("jdbc:odbc:access");
      String sql = "Select * from table";
      Statement stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery( sql );
      ResultSetMetaData md = rs.getMetaData();
      int columns = md.getColumnCount();
      for (int i = 1; i &lt;= columns; i++) {
          columnNames.addElement( md.getColumnName(i) );
      }
      while (rs.next()) {
          Vector row = new Vector(columns);
          for (int i = 1; i &lt;= columns; i++){
              row.addElement( rs.getObject(i) );
          }
          data.addElement( row );
      }
      rs.close();
      stmt.close();
  }catch(Exception e){
      System.out.println(e);
  }
  </code></pre>
  
  <p>It displays:</p>
  
  <pre><code>java.sql.SQLException:[Microsoft][ODBC Driver Manager] Invalid descriptor index
  </code></pre>
  
  <p>How is this caused and how can I solve it?</p>