title: String Index out of range Exception in jdbc programming
body: <p>I have a database table consisting of 6 columns and 6 rows. I want to access all 6 column values of the 2nd row, but I'm unable to figure out why I'm getting this exception.</p>
  
  <pre><code>public void send()
  {
  int row=2;
      try
      {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection cn=DriverManager.getConnection("jdbc:odbc:DSN2");
      Statement st=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
      ResultSet rs=st.executeQuery("select *from Table1");
      rs.absolute(row);
      System.out.println(rs.getInt(1)+"\t"+rs.getInt(2)+"\t"+rs.getInt(3)+"\t"+rs.getInt(4)+"\t"+rs.getInt(5)+"\t"+rs.getInt(6));
  
      }
  </code></pre>
  
  <blockquote>
    <p>java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1958) at sun.jdbc.odbc.JdbcOdbcResultSet.reWordAsCountQuery(JdbcOdbcR‌​esultSet. java:6557) at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount(JdbcOdbcRe‌​sultSet.j ava:6350) at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(JdbcOdbcResultSet‌​.java:154) at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(JdbcOdbcStateme‌​nt.java:4 23) at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStateme‌​nt.java:2 53)at Router.send(Router1.java:37)at Router1.main(Router1.java:54)</p>
  </blockquote>