spring 数据源配制

阅读更多
spring数据源配制 , 用于替代hibernate.cfg.xml









	
	
		
			
				classpath:jdbc.properties
			
		
	

	
	

		
			${jdbc.driverClassName}
		
		
			${jdbc.url}
		
		
			${jdbc.username}
		
		
			${jdbc.password}
		
		
		
			${c3p0.initialPoolSize}
		
		
			${c3p0.minPoolSize}
		
		
			${c3p0.maxPoolSize}
		
		
			${c3p0.acquireIncrement}
		
		
			${c3p0.maxIdleTime}
		
	


	
	
		
			
		

		
		
			
				classpath:/com/tuozhi/model/
			
		

		
		
			
				org.hibernate.dialect.SQLServerDialect
				true
				update
			
		
	







配制jdbc连接属性文件, jdbc.properties

 #jdbc\u914d\u7f6e
jdbc.driverClassName=net.sourceforge.jtds.jdbc.Driver
jdbc.url=jdbc:jtds:sqlserver://localhost:1433/pubs
jdbc.username=sa
jdbc.password=sa


#\u4f18\u5316\u8bbe\u7f6ec3p0\u8fde\u63a5\u6c60\u53c2\u6570
#\u8fde\u63a5\u6c60\u521d\u59cb\u5316\u65f6\u83b7\u53d6\u7684\u94fe\u63a5\u6570
c3p0.initialPoolSize=2
#\u6700\u5c0f\u94fe\u63a5\u6570
c3p0.minPoolSize=2
#\u6700\u5927\u8fde\u63a5\u6570
c3p0.maxPoolSize=30
#\u5728\u5f53\u524d\u8fde\u63a5\u6570\u8017\u5c3d\u7684\u65f6\u5019\uff0c\u4e00\u6b21\u83b7\u53d6\u7684\u65b0\u7684\u8fde\u63a5\u6570
c3p0.acquireIncrement=5
#\u6700\u5927\u7a7a\u95f2\u7684\u65f6\u95f4\uff0c\u5355\u4f4d\u662f\u79d2\uff0c\u65e0\u7528\u7684\u94fe\u63a5\u518d\u8fc7\u65f6\u540e\u4f1a\u88ab\u56de\u6536
c3p0.maxIdleTime=20

 




你可能感兴趣的:(Spring,JDBC,Hibernate,Bean,XML)