Guest User

Untitled

a guest
Aug 28th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.42 KB | None | 0 0
  1. Hibernate/Spring: Lots (thousands) of open connections the database
  2. tcp6 0 0 ************:53547 ************:3306 TIME_WAIT 0 0 -
  3. tcp6 0 0 ************:53595 ************:3306 TIME_WAIT 0 0 -
  4. tcp6 0 0 ************:53645 ************:3306 TIME_WAIT 0 0 -
  5. tcp6 0 0 ************:34986 ************:3306 TIME_WAIT 0 0 -
  6. tcp6 0 0 ************:53669 ************:3306 TIME_WAIT 0 0 -
  7. tcp6 0 0 ************:53710 ************:3306 TIME_WAIT 0 0 -
  8. tcp6 0 0 ************:53757 ************:3306 TIME_WAIT 0 0 -
  9. tcp6 0 0 ************:53716 ************:3306 TIME_WAIT 0 0 -
  10. tcp6 0 0 ************:53627 ************:3306 TIME_WAIT 0 0 -
  11. tcp6 0 0 ************:53752 ************:3306 TIME_WAIT 0 0 -
  12. tcp6 0 0 ************:53505 ************:3306 TIME_WAIT 0 0 -
  13. tcp6 0 0 ************:53549 ************:3306 TIME_WAIT 0 0 -
  14. tcp6 0 0 ************:35185 ************:3306 TIME_WAIT 0 0 -
  15. tcp6 0 0 ************:53604 ************:3306 TIME_WAIT 0 0 -
  16. tcp6 0 0 ************:35331 ************:3306 TIME_WAIT 0 0 -
  17. tcp6 0 0 ************:53488 ************:3306 TIME_WAIT 0 0 -
  18. tcp6 0 0 ************:34938 ************:3306 TIME_WAIT 0 0 -
  19. tcp6 0 0 ************:34987 ************:3306 TIME_WAIT 0 0 -
  20. tcp6 0 0 ************:53695 ************:3306 TIME_WAIT 0 0 -
  21. tcp6 0 0 ************:35380 ************:3306 TIME_WAIT 0 0 -
  22. tcp6 0 0 ************:53651 ************:3306 TIME_WAIT 0 0 -
  23.  
  24. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  25. <property name="driverClassName">
  26. <value>com.mysql.jdbc.Driver</value>
  27. </property>
  28. <property name="url">
  29. <value>jdbc:mysql://************:3306/********</value>
  30. </property>
  31. <property name="username">
  32. <value>********</value>
  33. </property>
  34. <property name="password">
  35. <value>********</value>
  36. </property>
  37. </bean>
  38.  
  39. <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  40. <property name="dataSource">
  41. <ref bean="dataSource" />
  42. </property>
  43. <property name="configLocation">
  44. <value>WEB-INF/hibernate.hbm.xml</value>
  45. </property>
  46. <property name="configurationClass">
  47. <value>org.hibernate.cfg.AnnotationConfiguration</value>
  48. </property>
  49. <property name="hibernateProperties">
  50. <props>
  51. <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
  52. <prop key="hibernate.jdbc.batch_size">0</prop>
  53. <prop key="hibernate.show_sql">false</prop>
  54. <prop key="hibernate.bytecode.provider">cglib</prop>
  55. <prop key="hibernate.hbm2ddl.auto">update</prop>
  56. </props>
  57. </property>
  58. <property name="eventListeners">
  59. <map>
  60. <entry key="save-update" value-ref="saveUpdateEventListener" />
  61. </map>
  62. </property>
  63. </bean>
  64.  
  65. <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  66. <property name="sessionFactory" ref="sessionFactory" />
  67. </bean>
  68.  
  69. Hibernate will obtain and pool connections using java.sql.DriverManager if you set the following properties:
  70.  
  71. Table 3.1. Hibernate JDBC Properties
  72.  
  73. Property name Purpose
  74. hibernate.connection.driver_class JDBC driver class
  75. hibernate.connection.url JDBC URL
  76. hibernate.connection.username database user
  77. hibernate.connection.password database user password
  78. hibernate.connection.pool_size maximum number of pooled connections
Add Comment
Please, Sign In to add comment