filmov
tv
Lesson - 27 : Hibernate - Built-in connection pooling in Hibernate
Показать описание
Hibernate – Built-in Connection Pooling in Hibernate:
1. If a java program wants to obtain a connection with a database then java API as provided or JDBC API as provided two ways.
2. If a java program want to get direct connection with the database then we use DriverManager class.
3. The connection returned by DriverManager class is a nonreusable connection. The non reusable connections will increase the burden on a database.
4. To overcome the above problem we got connection pooling technique in java.
5. In connection pooling a group of reusable connections(pooled connections) are stored in a pool and the connections are provided to the clients whenever required.
6. To obtain a connection from a connection pool we use DataSource interface in a java program
In hibernate connection pooling mechanism is divided into three types
1. Built-in connection pooling / jdbc connection pooling
2. Standalone connection pooing/Third party connection pooling
3. Server side connection pooling
Built-in connection pooling / jdbc connection pooling :
1. Hibernate by default comes with automatic connection pool. This is also called jdbc connection pool.
2. As a programmer we are allowed to set the maximum pool size for hibernate built- in connection pool
Configurations:
<hibernate-configuration>
<session-factory>
</session-factory>
</hibernate-configuration>
1. If a java program wants to obtain a connection with a database then java API as provided or JDBC API as provided two ways.
2. If a java program want to get direct connection with the database then we use DriverManager class.
3. The connection returned by DriverManager class is a nonreusable connection. The non reusable connections will increase the burden on a database.
4. To overcome the above problem we got connection pooling technique in java.
5. In connection pooling a group of reusable connections(pooled connections) are stored in a pool and the connections are provided to the clients whenever required.
6. To obtain a connection from a connection pool we use DataSource interface in a java program
In hibernate connection pooling mechanism is divided into three types
1. Built-in connection pooling / jdbc connection pooling
2. Standalone connection pooing/Third party connection pooling
3. Server side connection pooling
Built-in connection pooling / jdbc connection pooling :
1. Hibernate by default comes with automatic connection pool. This is also called jdbc connection pool.
2. As a programmer we are allowed to set the maximum pool size for hibernate built- in connection pool
Configurations:
<hibernate-configuration>
<session-factory>
</session-factory>
</hibernate-configuration>
Комментарии