数据库连接异常java.sql.SQLException: Unknown character set index for field '224' received from server.
2018-11-13 11:18:14 执行存储过程    actual_time_base(2018-11-13)
Exception in thread "main" java.lang.NullPointerException
        at cn.com.letang.databaseConnection.DatabaseManager.query2(DatabaseManager.java:109)
        at cn.com.letang.MainManager.run(MainManager.java:139)
        at cn.com.letang.MainManager.main(MainManager.java:94)
        
登陆数据库
mysql> show variables like "%character%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /opt/mysql/share/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

上面的报错,是由于MySQL的字符集导致,修改为my.cnf的字符集为utf8,然后在重启MySQL服务,就OK了。

点评
还没有点评哦!