Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
程序员文章站
2022-04-25 16:22:22
...
hibernate连接mysql数据库时运行代码,出现这个错误
因为报错是cannot open connection,开始一直以为是数据库连接的问题
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
....................
Caused by: java.sql.SQLException: Unknown system variable 'tx_isolation'
....................
后来发现出错原因是没有加日志的属性文件log4j.properties,加上属性文件之后,程序就可以运行了
推荐阅读
-
ERROR: Field 'PostId' doesn't have a default value Exception in thread "main" org.hibernate.exception.GenericJDBCException: coul
-
org.hibernate.exception.SQLGrammarException: Cannot open connection解决
-
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
-
解决org.hibernate.exception.GenericJDBCException: Cannot open connection
-
org.hibernate.exception.JDBCConnectionException: Cannot open connection
-
ERROR: Field 'PostId' doesn't have a default value Exception in thread "main" org.hibernate.exception.GenericJDBCException: coul