title: How can I solve this BigInteger into 'java.lang.Long' problem?
body: <pre><code>import java.sql.*;
  
  class MysqlCon {
  
      public static void main(String args[]) {
          try {
              Class.forName("com.mysql.jdbc.Driver");
              Connection con = DriverManager.getConnection(
                      "jdbc:mysql://localhost:3306/banco", "matheus", "123456");
              Statement stmt = con.createStatement();
              ResultSet rs = stmt.executeQuery("select * from usuario");
              while (rs.next()) {
                  System.out.println(rs.getInt(1) + "  " + rs.getString(2) + "  " + rs.getString(3));
              }
              con.close();
          } catch (ClassNotFoundException | SQLException e) {
              System.out.println(e);
          }
      }
  }
  </code></pre>
  
  <p>This code is throwing an error: </p>
  
  <blockquote>
    <p>java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long</p>
  </blockquote>
  
  <p>I also have an table on Workbench with columns: </p>
  
  <pre><code>id (int), name (varchar), age (varchar).
  </code></pre>
  
  <p>Any help?</p>
  
  <p><strong>Using 'e.printStackTrace()':</strong></p>
  
  <pre><code>run:
  java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
      at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:1062)
      at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3556)
      at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2513)
      at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2283)
      at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:822)
      at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:47)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
      at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:404)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317)
      at java.sql.DriverManager.getConnection(DriverManager.java:664)
      at java.sql.DriverManager.getConnection(DriverManager.java:247)
      at MysqlCon.main(MysqlCon.java:10)
  Caused by: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
      at com.mysql.jdbc.ConnectionImpl.buildCollationMapping(ConnectionImpl.java:1007)
      ... 15 more
  CONSTRUÍDO COM SUCESSO (tempo total: 1 segundo)
  </code></pre>