Unknown initial character set index '255' received from server. Initial client character 解

2024-10-09 11:01:27 浏览数 (4)

Unknown initial character set index '255' received from server. Initial client character 解决方法

mysql连接数据库时报此错误:

//String url = "jdbc:mysql://localhost:3306/mytest_db" 如果使用这句就会报错。 //Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property. String url = "jdbc:mysql://localhost:3306/mytest_db?useUnicode=true&characterEncoding=utf8"; //改成这句,就可以了

代码语言:javascript复制
#jdbc.mysql.className=com.mysql.jdbc.Driver
jdbc.mysql.className=com.p6spy.engine.spy.P6SpyDriver
#jdbc.mysql.url=jdbc:mysql://127.0.0.1:3306/mytest_db?useUnicode=true&characterEncoding=utf-8
##&修改成& 可以解决报错
jdbc.mysql.url=jdbc:mysql://127.0.0.1:3306/mytest_db?useUnicode=true&characterEncoding=utf-8
jdbc.mysql.user=test
jdbc.mysql.password=test

jdbc.dbcp.maxActive=30
jdbc.dbcp.maxIdle=16
jdbc.dbcp.maxWait=10000
jdbc.dbcp.defaultAutoCommit=true
jdbc.dbcp.removeAbandoned=true
jdbc.dbcp.removeAbandonedTimeout=60
jdbc.dbcp.logAbandoned=true

0 人点赞