ssh连接mysql数据库问题
我在spring配置中这样设置,为什么一直提示我没连接上sqlserver数据库,为什么不是mysql数据库呢。。。<?xmlversion="1.0"encoding=...
我在spring配置中这样设置,为什么一直提示我没连接上sqlserver数据库,为什么不是mysql数据库呢。。。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- 定义数据源 -->
<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://127.0.0.1/MyBlog</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>5252</value>
</property>
</bean>
<!-- 定义SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>org/lxh/blog/model/User.hbm.xml</value>
<value>org/lxh/blog/model/Article.hbm.xml</value>
<value>org/lxh/blog/model/BlogInfo.hbm.xml</value>
<value>org/lxh/blog/model/Critique.hbm.xml</value>
<value>org/lxh/blog/model/Dianjiliang.hbm.xml</value>
</list>
</property>
</bean>
<!-- 定义hibernateTemplate -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean> 展开
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- 定义数据源 -->
<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://127.0.0.1/MyBlog</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>5252</value>
</property>
</bean>
<!-- 定义SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>org/lxh/blog/model/User.hbm.xml</value>
<value>org/lxh/blog/model/Article.hbm.xml</value>
<value>org/lxh/blog/model/BlogInfo.hbm.xml</value>
<value>org/lxh/blog/model/Critique.hbm.xml</value>
<value>org/lxh/blog/model/Dianjiliang.hbm.xml</value>
</list>
</property>
</bean>
<!-- 定义hibernateTemplate -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询