在默認通過myeclipse生成的配置裡
<bean id=
class=
<property name=
value=
</property>
<property name=
value=
</property>
<property name=
<property name=
</bean>
如果改為C
<bean id=
class=
<property name=
<value>classpath:jdbc
</property>
</bean>
<bean id=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
</bean>
jdbc
# Database URL
jdbc
# Database login information
jdbc
jdbc
# Time to wait for an open connection before timing out
# (in milliseconds)
cpool
# Connection pool size
cpool
cpool
# How long to keep unused connections around(in seconds)
# Note: MySQL times out idle connections after
# so ensure this value is below MySQL idle timeout
cpool
# How long to hang on to excess unused connections after traffic spike
# (in seconds)
cpool
# Acquiring new connections is slow
# when current pool size is reached
cpool
或者將上面的
<bean id=
<property name=
<value>${jdbc
</property>
<property name=
<value>${jdbc
</property>
<property name=
<value>${jdbc
</property>
<property name=
<value>${jdbc
</property>
<property name=
<property name=
<property name=
<property name=
<property name=
<property name=
</bean>
如果使用的是受管理的J
<bean id=
<property name=
<value>java:comp/env/jndi/xxx</value>
</property>
</bean>
如果在應用裡有獨自使用hibernate
<bean id=
class=
<property name=
<value>oracle
</property>
<property name=
<value>jdbc:oracle:thin:@
</property>
<property name=
<value>hl
</property>
<property name=
<value>hldw
</property>
</bean>
<bean id=
class=
<property name=
<ref bean=
</property>
<property name=
<props>
<prop key=
<prop key=
<!
<prop key=
<prop key=
<prop key=
<prop key=
<prop key=
<prop key=
<prop key=
<prop key=
</props>
</property>
<property name=
<list>
<value>com/hl
</list>
</property>
</bean>
spring中配置獨立使用hibernate時使用jndi的配置
hibernate
nnection
hibernate
如果是使用不受管理的Servlet容器如Tomcat
<Resource name=
type=
<ResourceParams name=
<parameter><name>username</name><value>root</value></parameter>數據庫的名稱
<parameter><name>password</name><value>password</value></parameter>數據庫密碼
<parameter><name>driverClassName</name>
<value>org
<parameter><name>url</name>
<value>jdbc:mysql://
</ResourceParams>
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28471.html