Sponsered Links
Categories
Sponsered Links

Using hibernate.properties for C3P0 connection pool settings

 

This code’s lines specify the following information, beginning with the first line:

■ The name of the Java class implementing the JDBC Driver (the driver JAR file must be placed in the application’s classpath).

■ A JDBC URL that specifies the host and database name for JDBC connections.

■ The database user name.

■ The database password for the specified user.

■ A Dialect for the database. Despite the ANSI standardization effort, SQL is implemented differently by various databases vendors. So, you must specify a Dialect. Hibernate includes built-in support for all popular SQL databases, and new dialects may be defined easily.

■ The minimum number of JDBC connections that C3P0 will keep ready.

■ The maximum number of connections in the pool. An exception will be thrown at runtime if this number is exhausted.

■ The timeout period (in this case, 5 minutes or 300 seconds) after which an idle connection will be removed from the pool.

■ The maximum number of prepared statements that will be cached. Caching of prepared statements is essential for best performance with Hibernate.

■ The idle time in seconds before a connection is automatically validated.

 

hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql://localhost/auctiondb
hibernate.connection.username = auctionuser
hibernate.connection.password = secret
hibernate.dialect = net.sf.hibernate.dialect.PostgreSQLDialect
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=300
hibernate.c3p0.max_statements=50
hibernate.c3p0.idle_test_period=3000

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved