Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hibernate/Spring: Lots (thousands) of open connections the database
- tcp6 0 0 ************:53547 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53595 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53645 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:34986 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53669 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53710 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53757 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53716 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53627 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53752 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53505 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53549 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:35185 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53604 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:35331 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53488 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:34938 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:34987 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53695 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:35380 ************:3306 TIME_WAIT 0 0 -
- tcp6 0 0 ************:53651 ************:3306 TIME_WAIT 0 0 -
- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName">
- <value>com.mysql.jdbc.Driver</value>
- </property>
- <property name="url">
- <value>jdbc:mysql://************:3306/********</value>
- </property>
- <property name="username">
- <value>********</value>
- </property>
- <property name="password">
- <value>********</value>
- </property>
- </bean>
- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="dataSource">
- <ref bean="dataSource" />
- </property>
- <property name="configLocation">
- <value>WEB-INF/hibernate.hbm.xml</value>
- </property>
- <property name="configurationClass">
- <value>org.hibernate.cfg.AnnotationConfiguration</value>
- </property>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
- <prop key="hibernate.jdbc.batch_size">0</prop>
- <prop key="hibernate.show_sql">false</prop>
- <prop key="hibernate.bytecode.provider">cglib</prop>
- <prop key="hibernate.hbm2ddl.auto">update</prop>
- </props>
- </property>
- <property name="eventListeners">
- <map>
- <entry key="save-update" value-ref="saveUpdateEventListener" />
- </map>
- </property>
- </bean>
- <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
- Hibernate will obtain and pool connections using java.sql.DriverManager if you set the following properties:
- Table 3.1. Hibernate JDBC Properties
- Property name Purpose
- hibernate.connection.driver_class JDBC driver class
- hibernate.connection.url JDBC URL
- hibernate.connection.username database user
- hibernate.connection.password database user password
- hibernate.connection.pool_size maximum number of pooled connections
Add Comment
Please, Sign In to add comment