ssh框架数据库在哪配置连接

ssh框架数据库在哪配置连接,第1张

applicationContext.xml文件里,

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:tx="http://www.springframework.org/schema/tx"

xmlns:aop="http://www.springframework.org/schema/aop"

xmlns:compass="http://www.compass-project.org/schema/spring-core-config"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd

http://www.compass-project.org/schema/spring-core-config http://www.compass-project.org/schema/spring-compass-core-config-2.1.xsd">

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"

destroy-method="close">

<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/mysql" />

<property name="driverClass" value="com.mysql.jdbc.Driver" />

<property name="user" value="root"></property>

<property name="password" value=""></property>

<property name="maxPoolSize" value="40" />

<property name="minPoolSize" value="1" />

<property name="initialPoolSize" value="1" />

<property name="maxIdleTime" value="20" />

</bean>

在hibernate的配置文件中有关于数据库连接的设置(DataSource那项),里面有范例设置,你只要把 <!-- -->删除掉,然后把数据库连接到 driver,username,password,url等信息设置成你的数据库服务器即可


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/10829618.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-11
下一篇 2023-05-11

发表评论

登录后才能评论

评论列表(0条)

保存