日期:2014-05-16  浏览次数:20531 次

jdbc连接数据库例子
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="driverClass" value="com.mysql.jdbc.Driver">
		</property>
		<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/schemaName">
		</property>
		<!--
			<property name="user" value="root"></property> <property
			name="password" value="123"></property>
		-->
		<property name="properties">
			<props>
				<prop key="user">root</prop>
				<prop key="password">123</prop>
				<!--
					===================================================================
				-->
				<!--配置c3p0参数-->
				<!--
					===================================================================
				-->
				<prop key="hibernate.c3p0.acquire_increment">2</prop>
				<prop key="hibernate.c3p0.idle_test_period">3000</prop>
				<prop key="hibernate.c3p0.timeout">5000</prop>
				<prop key="hibernate.c3p0.max_size">200</prop>
				<prop key="hibernate.c3p0.min_size">1</prop>
				<prop key="hibernate.c3p0.max_statements">800</prop>
				<prop key="hibernate.c3p0.validate">false</prop>
				<prop key="c3p0.testConnectionOnCheckout">true</prop>
			</props>
		</property>
	</bean>