Alex Rivera | Logout

Best configuration of c3p0

Asked 2012-09-20T06:20:05.727
40

I'm struggling with a problem facing c3p0 configuration. I posted a question last week

Edit
Report

1 Answer

2

Best configuration is to setup JPA to use the container environment to get DataSource.

This allows the container to provide the connection pooling rather than configuration it directly into your JPA project.

You do not indicate which container enviroment you are working with. I almost always use c3p0 with Standalone applications, such as Java SE desktop or server applications. I also use it with Spring framework.

When using a container such as Servlet (Tomcat/Jetty) or Application Server (such as Glashfish or JBoss AS) these already provide a DataSource connection pooler implementation that is usually not c3p0 but provides equivalent function.

I have never tried to configure a connection pooler inside a JPA project because this means editing configuration to customize it for every environment it needs to run in. This is a headache so it best that JPA part be given the DataSource to use during bootstrap.

answered 2012-09-20T07:04:20.203

Your Answer