日期:2014-05-17  浏览次数:20877 次

求助!!ssh版本的oa与mysql不能交互
各位大神帮帮我,这是我的毕业设计,是一个用ssh写的oa系统,数据库用的是mysql,oa源码是网上下载的,我在mysql里把所有该建的表都建了,也连接上了.applicationContext.xml里面的库表配置也都配置了,可是就是报错:Caused by: java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communication failure during handshake. Is there a server running on localhost:3306?)


<!-- 配置数据源 -->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>org.gjt.mm.mysql.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/demo?useUnicode=true&amp;characterEncoding=utf-8</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
</bean>
  <!-- 配置Hibernate -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>com/demo/hibernate/beans/User.hbm.xml</value>
<value>com/demo/hibernate/beans/Address.hbm.xml</value>
<value>com/demo/hibernate/beans/Schedule.hbm.xml</value>
<value>com/demo/hibernate/beans/Worklog.hbm.xml</value>
<value>com/demo/hibernate/beans/Sms.hbm.xml</value>
<value>com/demo/hibernate/beans/Notice.hbm.xml</value>
<value>com/demo/hibernate/beans/Meeting.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>


<!-- 配置事务 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
我用的服务器是tomcat 6 mysql的jar包我也加了 mysql.2.0.4.jar 浏览器里运行的时候全是静态页面,点提交之类的按钮没有反应,代码里按钮的触发事件也没错,各位大神帮帮我,有人了解的要是觉得我还有什么信息提供不全的可以加我qq472331480.万分感谢 !

------解决方案--------------------
mysql-2.0.4.jar,换成mysql-connector-java-5.16-bin.jar
------解决方案--------------------

<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/test</value>
</property>
<property name="username">
<value>root<