c3p0

What is the benefit of Connection and Statement Pooling ?

Can someone explain what is Connection and Statement Pooling and what is the benefit over unpooled DataSources? I am trying to understand when it is a good idea to use a technology like c3p0 or proxool in a project. I need first to understand what they do and when it interesting to use them. Thank you very much. ...

Which are the required C3P0 settings for hibernate in order to avoid Deadlocks

I use Hibernate together with MySQL 5.1.30. I have the next libraries: c3p0-0.0.1.2.jar mysql-connector-java-5.0.3-bin.jar hibernate3.jar I use a hibernate.cfg.xml for configuration: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-c...

Connection pooling options with JDBC: DBCP vs C3P0

What is the best connection pooling library available for Java/JDBC? I'm considering the 2 main candidates (free / open-source): Apache DBCB - http://commons.apache.org/dbcp/ C3P0 - http://sourceforge.net/projects/c3p0 I've read a lot about them in blogs and other forums but could not reach a decision. Is there any relevant altern...

Is JDBC Connection aquiring with MySQL slower than with e.g. Derby ?

I use Tomcat C3p0 (JNDI configured inside Tomcat) MySQL(InnoDB) / Derby(not embedded) as Database EHCache (in Memory) Hibernate Testmachine runs WinXP I used Derby for development and wanted to switch to MySQL. I was surprised to see, that with MySQL my Tests were app. 50% slower than with Derby. My Testscenario : app. 2000 Selec...

Lock Ordering in C3p0

I am trying to log the creation and destruction of database connections in our application using c3p0's ConnectionCustomizer. In it, I have some code that looks like this: log(C3P0Registry.getPooledDataSources()) I'm running into deadlocks. I'm discovering that C3p0 has at least a couple objects in its library that use synchronized m...

Hibernate, C3P0, Mysql -- Broken Pipe

MySQL seems to have an 8 hour time out on its connections. I'm running multiple WARs in Tomcat utilizing Hibernate for ORM. After 8 hours (i.e. overnight), I get broken pipes when it picks up an idle connection. I've already traced through the code and made doubly sure I commit or roleback all transactions. Here is my hibernate.cfg.x...

How can I configure hibernate to use context-specific connection information?

I'm writing a J2SE (Note, not JEE) application using Hibernate, and I need to provide a different connection to Hibernate for each thread of execution. These connections must be pooled, and each one has at the very least different authentication and, possibly, a different JDBC URL. The connections will be re-used (as can be inferred fr...

Maven doesn't resolve hibernate-c3p0's dependency on slf4j

When I include hibernate-c3p0 in my Maven's pom.xml file, I get a runtime NoClassDefFoundError as it can't find org.slf4j.impl.StaticLoggerBinder. It was my impression that Maven would resolve this dependency – so if c3p0 requires slf4j, then slf4j would be downloaded and included. My pom.xml file has: <dependency> <groupId>org.hiber...

Hibernate c3p0 connection pool not timing out idle connections

We have a java server connecting to a MySQL 5 database usingHibernate as our persistence layer which is using c3p0 for DB connection pooling. I've tried following the c3p0 and hibernate documentation: Hibernate - HowTo Configure c3p0 connection pool C3P0 Hibernate properties C3P0.properties configuration We're getting an error on ...

How do I decide the number of connections required in connection pooling?

I am using hibernate 3.2.2 in my application. For connection pooling, we are using c3p0 0.9.1. I am using Generic DAO Pattern and Open Session in View pattern to do database operation. We are working on new website of existing website. Right now, the no of visits is half million page visit in existing application. I am confused with t...

JDBC Connection pooling using C3P0

Following is my helper class to get DB connection: I've used the C3P0 connection pooling as described here. public class DBConnection { private static DataSource dataSource; private static final String DRIVER_NAME; private static final String URL; private static final String UNAME; private static final String PWD; ...

How to configure query timeout threshhold for c3p0/hibernate

I have an application that is using Hibernate 3, c3p0, and spring 2.5.6. We have a datasource that is configured to speak with a postgres database. Everything was working great until a firewall was introduced between the application server and the database. We intermittently are getting java.net.SocketTimeoutException: Read Timed Out err...

Reproduce com.mysql.jdbc.exceptions.jdbc4.CommunicationsException with a setup of Spring, hibernate and C3P0

I got this error from the production code: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was36940 seconds ago.The last packet sent successfully to the server was 36940 seconds ago, which is longer than the server configured value of 'wait_timeout'. You sho...

Logback - C3P0 and HSQLDB

I'm trying to get LogBack to use a HSQLDB with C3P0. I'm stuck with this configuration at the moment given my current environment. I have a large investment with Log4J code and will also need to use the SLF4J Log4J Adapter. When I try a simple logging program it's getting stuck in the configuration of the logger. Here is my logback.xml:...

Hibernate takes 10 mins to throw exception when database is down

I am running Spring + hibernate 3 + c3p0. Upon start up, if the database is down an exception is thrown after about 10 mins. Until then the program is blocked... I dont include spring xml, hibernate configuration etc, since it is a fairly common problem and if a solution exists it must be a standard straighforward way. If not i can trim ...

hibernate c3p0 broken pipe

Hi, I'm using hibernate 3 with c3p0 for a program which constantly extracts data from some source and writes it to a database. Now the problem is, that the database might become unavailable for some reasons (in the simplest case: i simply shut it down). If anything is about to be written to the database there should not be any exceptio...

SQL Server 2005 - Cannot rollback nested transaction

Hi everybody, Sometimes I get the following from SQL Server 2005 when executing a stored procedure: Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot roll back T1. No transaction or savepoint of that name was found. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source) at com...

Multiple Hibernate instances using C3P0

I am facing a weird problem and it seems to be c3p0 related. I am starting two instances of an app in the same java vm which interact with each other. After some operations "APPARENT DEADLOCK" messages appear in the log. I have the feeling that both app instances use the same connection pool although they use different session factory i...

java.lang.NoSuchMethodException: com.mchange.v2.c3p0.PoolBackedDataSource.setUserOverridesAsString(java.lang.String)

Hi all. I'm using C3P0 0.9.1.2 to configure data sources for my connection pool. When context is loading an error is raised. Here is the trace: java.lang.NoSuchMethodException: com.mchange.v2.c3p0.PoolBackedDataSource.setUserOverridesAsString(java.lang.String) at java.lang.Class.getMethod(Class.java:1605) at com.mchange.v2.c3p0...

Hibernate, C3P0, Mysql Connection Pooling

Hi all, I recently switched from Apache DBCP connection pooling to C3P0 and have gone through my logs to see that there are connection timeout issues. I haven't had this in the past with DBCP and Tomcat, so I'm wondering if it is a configuration issue or driver issue. Whenever I load a page after the server has been idle for a while, ...