No suitable driver found for jdbc:mysql://localhost:3306/hibernate_basic

Struts Problem Report

Struts has detected an unhandled exception:

Messages:
  1. No suitable driver found for jdbc:mysql://localhost:3306/hibernate_basic
  2. Cannot open connection
  3. Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection
File: java/sql/DriverManager.java
Line number: 604

 

调试了半天,在@test程序中都能连接数据库正确

后来在 hibernate.cfg.xml中加入

<property name="connection.driver_class">com.mysql.jdbc.Driver</property>

就正常运行了

No suitable driver found for jdbc:mysql://localhost:3306/hibernate_basic,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。