Questions tagged [apache-commons-dbcp]

Apache-commons-dbcp provides an efficient implementation of the Database Connection Pool under the Apache license.

Many projects support interaction with a relational database. Creating a new connection for each user can be time consuming (often requiring multiple seconds of clock time), in order to perform a database transaction that might take milliseconds. Opening a connection per user can be unfeasible in a publicly-hosted Internet application where the number of simultaneous users can be very large. Accordingly, developers often wish to share a "pool" of open connections between all of the application's current users. The number of users actually performing a request at any given time is usually a very small percentage of the total number of active users, and during request processing is the only time that a database connection is required. The application itself logs into the DBMS, and handles any user account issues internally.

Apache-commons-dbcp coordinates the efforts required to create and maintain an efficient, feature-rich Database Connection Pool package under the ASF.

394 questions
4
votes
2 answers

How to view/monitor live database connections in a database pool?

We use database connection pooling for our java application. It is a web app run under tomcat. I want to view live connections in the pool as they are created and destroyed. Can somebody please help? UPDATE: We are using Oracle 11g. We use…
user32262
  • 8,660
  • 21
  • 64
  • 77
4
votes
1 answer

Evicting connections to a read-only node in a cluster from the connection pool

My application connects to a fail-over cluster of two MySQL 5.6 (actually, Amazon Aurora) instances. The active node is always write-accessible, while the passive one is running in read_only mode (this is different from the canonical MySQL fail-over…
Bass
  • 4,977
  • 2
  • 36
  • 82
4
votes
2 answers

Issue with PostgreSQL: 'now' keeps returning same old value

I have an old web app, the relevant current stack is: Java 8, Tomcat 7, Apache Commons DBCP 2.1, Spring 2.5 (for transactions), iBatis, PostgreSQL 9.2 with postgresql-9.4.1208.jar Part of the code inserts new records in incidents table, where the…
leonbloy
  • 73,180
  • 20
  • 142
  • 190
4
votes
0 answers

How to configure JNDI datasource for database conection pooling in Google App Engine

My simple Google App Engine based web app needs to connect to a PostgreSQL database that has been developed and deployed on the Amazon RDS. My questions are: Can I use JNDI datasource in a GAE web app and how to connect to an external…
alextc
  • 3,206
  • 10
  • 63
  • 107
4
votes
0 answers

WARNING Failed to register in JMX: javax.naming.NamingException - tomcat dbcp2

I am using apache-tomcat-6.0.35 and upgraded DB Pooling Jar to commons-dbcp2-2.1.1.jar and commons-pool2-2.4.2.jar I made following changes in apache-tomcat-6.0.35/conf/context.xml file
Jatin
  • 197
  • 2
  • 5
  • 17
4
votes
1 answer

JTDS driver - Connection pooling vs Connection pool

I have been somewhat away from Java EE for a while, but I have a basic idea of all this stuff. I am reading the JTDS docs here: http://jtds.sourceforge.net/features.html It says it provides statement pooling, and connection pooling, but does not…
peter.petrov
  • 38,363
  • 16
  • 94
  • 159
4
votes
2 answers

How to configure MySQL connection properties with Spring, Hibernate 3.3 and c3p0?

I am currently in the process of upgrading an application from Hibernate 3.2 to Hibernate 3.3. I though I'd stick with the default connection pool (Hibernate changed its default from Commons DBCP to c3p0) as I don't have any good reason to choose a…
sfussenegger
  • 35,575
  • 15
  • 95
  • 119
4
votes
1 answer

What problems could occur using Apache Commons DBCP 1.4 on Java 7?

The Apache Commons DBCP overview page states: DBCP 2.0 compiles and runs under Java 7 only (JDBC 4.1) DBCP 1.4 compiles and runs under Java 6 only (JDBC 4) DBCP 1.3 compiles and runs under Java 1.4-5 only (JDBC 3) DBCP 2.0 binaries should be used…
Martin Pain
  • 713
  • 4
  • 18
4
votes
3 answers

Exceeding Maximum Idle Time in Java Web Application with Oracle DB

I have a Java web application connecting to an Oracle database running on another machine (not sure if this is relevant or not). I am using DBCP for connection pooling. The web application is running in JBoss 4.2.2 and we are defining our…
Rintoul
  • 823
  • 2
  • 13
  • 16
4
votes
3 answers

Java - DBCP vs JNDI?

I am a newbie and I have created a few simlpe Java Swing applications. I was able to use apache commons DBCP to create a connection pool and access the datasource. I have recently started to create java web based applciations using JSP and Servlets.…
user547453
  • 1,035
  • 6
  • 22
  • 38
4
votes
1 answer

Scheduler stopped when deadlock happened in Spring Transaction

I've developed a monitoring application that uses Spring-3.0 Hibernate-3.6.5 with SpringHibernateTemplate as DAO. Database SQL Server 2008. This app has long running transaction every day. @Repository("areaDaoHibernate") public class AreaDAO…
4
votes
2 answers

Tomcat: see what threads are using the database connection pool

Tomcat has a database connection pool (DBCP) to make requests faster. In my app, too many connections are being used for too long, I suspect a leak (connection not being properly closed) and I need to find out where is the leak. QUESTION: How to…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
3
votes
2 answers

How to configure DBCP PoolableConnectionFactory?

This is how I create a DataSource with DBCP 1.4 connection factory: PoolableConnectionFactory factory = new PoolableConnectionFactory( new DriverManagerConnectionFactory("jdbc:h2:mem:db", "", ""), new GenericObjectPool(null), null, "SELECT…
yegor256
  • 102,010
  • 123
  • 446
  • 597
3
votes
3 answers

How do I properly destroy an Apache Commons DBCP Pool in Java?

I would like to use a PoolingDataSource as my connection pool (API at: http://commons.apache.org/dbcp/apidocs/org/apache/commons/dbcp/PoolingDataSource.html), but I don't know what to do with the pool when I no longer need it. What if I want to…
3
votes
1 answer

DBCL message on console

I am creating a database connection pool with following properties.