1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. Querying a PostgreSQL Database in Java

Connected

Bài tập

Connection Pooling

Opening a new database connection for every request is slow and resource-intensive. Connection pooling solves this by reusing a pool of open connections. HikariCP is a popular, high-performance connection pool for Java applications.

Set up HikariCP for CityBook Libraries to improve their application's performance. HikariConfig, HikariDataSource, and database credentials are already imported for you.

Hướng dẫn

100 XP
  • Configure HikariConfig with the database URL, username, and password.
  • Create a HikariDataSource from the configuration.
  • Get a connection from the pool.