日期:2014-05-18  浏览次数:20925 次

急需帮助!Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql:/
初学hibernate,在连接mysql时,测试类main方法中可以运行获得数据,tomcat就报错
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://127.0.0.1:3306/test
求高手指点指点!!!


<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<property name="connection.driver-class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://127.0.0.1:3306/test</property>
<property name="connection.username">root</property>
<property name="connection.password">123123</property>

<property  name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="current_session_context_class">thread</property>

<mapping resource="ShoppingCart/shoppingcart.hbm.xml"></mapping>

</session-factory>
</hibernate-configuration>

------解决方案--------------------
貌似没添加mysql  jar包