Tag Archives: c3p0

C3P0 Production Settings

I have given below the configuration having in mind minimum resource. You need to tailor it according to your application need.

Generally in production release, we need to ensure the removal of unwanted configs which may cause some other problem after release in Live. The configuration should be accurate and don’t use counts blindly maximum.

C3P0 has many configurations, upon that here given the essential ones,

hibernate.connection.provider_class – org.hibernate.connection.C3P0ConnectionProvider

  • The above statement is used to specify the C3P0 connection provider. Here we use C3P0ConnnectionProvider class

hibernate.c3p0.max_size – 200

  •  This one tells the connection pool that it can hold 200 connections at the maximum

hibernate.c3p0.min_size  – 10

  •  This one tells the connection pool that it can hold 10 connections at the minimum. Generally this will vary from (3-20) based on the need.

hibernate.c3p0.acquire_increment – 100

  •  This determines how many connections the connection pool can acquire when the pool is exhausted.

hibernate.c3p0.idle_test_period – 120

  •  This will lets the C3P0 to test all the idle and uncheckedout connection in every this specified seconds. If the value is 0, then it won’t test.

hibernate.c3p0.max_statements – 2000

hibernate.c3p0.timeout – 60

  •  Its Default value is 0. Zero means, idle connections never expire. If the value given is greater than 0, then for the specified seconds the Connection can remain idle in pool but unused before discarded.

hibernate.c3p0.validate – true

  •  Default value is false. If we specify true, before every transaction gonna happen, it will validate the connection is valid or not. And we need to specify efficient preferredTestQuery.