import java.sql.*;
import java.math.*;
public class JavaApplication19 {
public static void main(String[] args) {
try {
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/sakila", "root", "ko875491");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select film_id, title from sakila.film;");
while (rs.next()) {
System.out.println(rs.getInt(1) + " " + rs.getString(2));
}
con.close();
} catch (SQLException e) {
System.out.println(e);
}
}
}
Netbeans 8.2 / MySQL Workbench 8.0.13版/在库中添加了MySQL JDBC驱动程序,并抛出此错误:
java.sql.SQLException:java.lang.ClassCastException: 无法将java.math.BigInteger强制转换为java.lang.Long
任何人都知道发生了什么事或有什么想法?