I. Proxool configuration
1. Persistence.xml
1. <?xml version= "1.0" encoding= "UTF-8"?> 2. <persistence version= "1.0" xmlns= "http://java.sun.com/xml/ns/persistence" xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance "xsi:schemalocation=" Http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/ Persistence/persistence_1_0.xsd "> 3. <persistence-unit name= "Crmpersistenceunit" transaction-type= "Resource_local" > 4. <provider>org.hibernate.ejb.HibernatePersistence</provider> 5. <properties> 6. <property name= "Hibernate.dialect" value= "Org.hibernate.dialect.Oracle10gDialect"/> 7. <property name= "Hibernate.cache.provider_class" value= "Org.hibernate.cache.NoCacheProvider"/> 8. <property name= "Hibernate.show_sql" value= "true"/> 9.
<property name= "Hibernate.format_sql" value= "true"/> 10. One. <!--hibernate proxool Connection pool configuration (requires jar package: Proxool.jar)--12. <properTy name= "Hibernate.connection.provider_class" value= "Org.hibernate.connection.ProxoolConnectionProvider"/> 13. <property name= "Hibernate.proxool.pool_alias" value= "Oraclepool"/> 14.
<property name= "Hibernate.proxool.xml" value= "Proxool.xml"/> 15. </properties> 17. </persistence-unit> 18. </persistence>
2. Add the Proxool.xml file in the SRC directory, the file configuration is as follows
1. <?xml version= "1.0" encoding= "Utf-8"?> 2. <something-else-entirely> 3. <proxool> 4. <alias>OraclePool</alias> 5. <!--Proxool can only manage the connections generated by itself--6. <driver-url>jdbc:oracle:thin: @localhost:1521:crm</driver-url> 7. <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> 8. <driver-properties> 9. <property name= "user" value= "CRM"/> 10. <property name= "Password" value= "crm123"/> 11. </driver-properties> 12. <!--Proxool automatically detects the time interval (in milliseconds) of each connection status, and detects that an idle connection is immediately recycled, and the timeout is destroyed--13.
Second, c3p0 link pool configuration
1. <?xml version= "1.0" encoding= "UTF-8"?> 2. <persistence version= "1.0" xmlns= "http://java.sun.com/xml/ns/persistence" xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance "xsi:schemalocation=" Http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/ Persistence/persistence_1_0.xsd "> 3. <persistence-unit name= "Tsspersistenceunit" transaction-type= "Resource_local" > 4. <provider>org.hibernate.ejb.HibernatePersistence</provider> 5.
<properties> 6. 7. <property name= "Hibernate.connection.url" value= "Jdbc:mysql://localhost:3306/jiaoyou"/> 8. <property name= "Hibernate.connection.driver_class" value= "Com.mysql.jdbc.Driver"/> 9. <property name= "Hibernate.connection.username" value= "Ganbin"/> 10. <property name= "Hibernate.connection.password" value= "tarena#2010"/> 11. <property name= "Hibernate.dialect" value= "Org.hibernate.dialeCt. Mysqldialect "/> 12. <property name= "Hibernate.cache.provider_class" value= "Org.hibernate.cache.NoCacheProvider"/> 13. <property name= "Hibernate.show_sql" value= "true"/> 14.
<property name= "Hibernate.format_sql" value= "true"/> 15.
<!--hibernate c3p0 Connection pool configuration (requires jar package: C3p0-0.9.0.4.jar)--17. <property name= "Hibernate.connection.provider_class" value= " Org.hibernate.connection.C3P0ConnectionProvider "/> 19. <!--minimum number of connections--20. <property name= "C3p0.min_size" value= "5"/> 21. <!--The maximum number of connections--22. <property name= "C3p0.max_size" value= "23"/>. <!--maximum idle time, unused in 60 seconds, the connection is discarded. If 0, it will never be discarded. Default:0-24. <property name= "c3p0.maxidletime" value= "/> 25". <!--Get the connection timeout, and if this time is exceeded, an exception is thrown, in milliseconds--and 26. <property name= "c3p0.timeout" value= "1800"/> 27. <!--the largest pThe number of reparedstatement and 28. <property name= "C3p0.max_statements" value= "29"/>. <!--check for idle connections in the connection pool every 120 seconds, in seconds--and 30. <property name= "C3p0.idle_test_period" value= "31"/>. <!--when the connection pool is out of use, C3P0 gets the new number of connections--32. <property name= "C3p0.acquire_increment" value= "1"/> 33. <!--Verify that the connection is available--34 each time.
<property name= "C3p0.validate" value= "false"/> 35. </properties> 37. </persistence-unit> 38. </persistence>