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
9
votes
2 answers

Connection Pool Exception: Cannot get a connection, pool error Timeout waiting for idle object

I am running a web application in Production that recently crashed after it was under some stress. I would guess 100-300 people were accessing the site at similar times, which I would expect to work fine. The logs around the time of the crash…
skaz
  • 21,962
  • 20
  • 69
  • 98
9
votes
1 answer

Tomcat 7 - Ignoring db conections pool parameters (DBCP)

We are facing a problem that the number of connections made to the database explodes during restarts of Tomcat 7. Our configurations are below, set on Tomcat's context.xml:
Marcelo Dias
  • 409
  • 2
  • 18
9
votes
1 answer

Hikari and test on borrow option

I use spring boot 2 with Hikari connection pool, jpa and postgres. Is there any reason to continue to use theses options spring.datasource.testOnBorrow=true spring.datasource.validationQuery=SELECT 1 spring.datasource.testWhileIdle
robert trudel
  • 5,283
  • 17
  • 72
  • 124
9
votes
2 answers

Tomcat Configuration using DBCP

We are getting a CommunicationsException (from DBCP) after iding for a while (a few hours). The error message (in the Exception) is at the end of this question - but I dont see wait_timeout defined in any of the configuration files. (Where should we…
Manidip Sengupta
  • 3,573
  • 5
  • 25
  • 27
8
votes
1 answer

Monitoring for Commons DBCP?

A huge webapp in my Tomcat sometimes starts using too many DBCP connections, leading to problems. To investigate, I want to know precisely at each point in time what thread/method is holding a connection of the pool. Does not need to be real-time,…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
7
votes
1 answer

Need generic solution for Spring based app for any Data source on Password expire

I don't know, how to approach a solution for the following scenario. We have a new requirement to remove DB Password from properties even though it's encrypted with Jasypt library or some other algorithms. Instead of storing the password in…
Viraj
  • 1,360
  • 3
  • 18
  • 38
7
votes
2 answers

NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory BasicDataSource Spring

I'm new to Spring, still learning. I'm using Spring Tool Suite version 3.5 with Java 6 on my Mac. I'm attempting to use BasicDataSource
user3636521
  • 71
  • 1
  • 1
  • 2
6
votes
1 answer

HikariCP/Apache DBCP2 and PgBouncer

After switching to PgBouncer in a Spring application that uses HikariCP(or Apache DBCP2) do I need to make additional configuration for HikriCP(or Apache DBCP2) side?
Radu Dumbrăveanu
  • 1,266
  • 1
  • 22
  • 32
6
votes
1 answer

What is the Spring 5 JDBC approach when nativeJdbcExtractor is needed?

I have just upgraded Spring/SpringBoot dependencies and noticed that class JdbcTemplate does not have property "nativeJdbcExtractor" any more. I was able to find the details and background: https://jira.spring.io/browse/SPR-14670 However I was not…
JavaDude
  • 165
  • 2
  • 9
6
votes
1 answer

Is the factory attribute for tomcat's server.xml required?

I have been reading more on JNDI in tomcat and I have read from multiple resources that the factory attributed is required. They say its often supposed to be "org.apache.tomcat.jdbc.pool.DataSourceFactory". However, most often I see something like…
Amir Raminfar
  • 33,777
  • 7
  • 93
  • 123
6
votes
2 answers

What is the best choice for database connection pooling library? (c3p0 problem)

I have heavy loaded java application using hirbernate. And I used to use as connection pool DBCP, but it had problems with connections lossing. Than I switched to c3p0. But now it sometimes bloks thread and I dont know why. Like…
6
votes
1 answer

Does DBCP connection pool connection.close() return connection to pool

Using BasicDataSource from DBCP if we do a getConnection() and in the finally block we close the connection does it really return the connection to the pool or does it close the connection. The snippet code I am checking is this try { …
6
votes
3 answers

Using PreparedStatement pooling in dbcp

Can someone explain how exactly prepared connection pooling using dbcp can be used? (with some example code if possible). I've figured out how to turn it on - passing a KeyedObjectPoolFactory to the PoolableConnectionFactory. But how should the…
Anand
  • 7,654
  • 9
  • 46
  • 60
5
votes
2 answers

DBCP returns closed connections

We are seeing situations where our database connection from org.apache.commons.dbcp.BasicDataSource is dying with socket write errors: com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error All subsequent…
Jim Burnell
  • 948
  • 3
  • 9
  • 21
5
votes
1 answer

Java connection to Sql server with jtds error

I use this code to make a connection with Sql server and i get that error when i use Class.forName(driver) it connect correctly but i prefer to use DataSourse. static final BasicDataSource dataSource = new BasicDataSource(); static { …
user3328090
  • 63
  • 1
  • 6
1 2
3
26 27