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
21
votes
3 answers

how to use (useUnicode=yes characterEncoding=UTF-8 ) with DBCP

I am trying to insert Arabic letter in to mysql database, but it only store "????". I am using DBCP for connecting with mysql databse, here is the datasource:
solidfox
  • 581
  • 1
  • 6
  • 20
19
votes
3 answers

What is difference between autoReconnect & autoReconnectForPools in MySql connector/J?

In the configuration reference for MySql's connector J driver, a caveat emptor is issued on the use of the autoReconnect property. I followed the instructions and increased my server's wait_timeout. Since I am using DBCP (I am considering moving to…
ashitaka
  • 3,928
  • 7
  • 38
  • 43
17
votes
5 answers

Deadlock issue in DBCP deployed on Tomcat

I'm using DBCP data source (with default configuration) in Spring configuration to manage my connections to the database, and I'm running into a deadlock condition when the number of clients increase. I found that there is a deadlock issue in DBCP…
Iravanchi
  • 5,139
  • 9
  • 40
  • 56
17
votes
1 answer

DBCP2 - When are Idle connections removed from the Pool

While configuring DBCP2 pool, and based on documentation I noticed that - there is a configuration called timeBetweenEvictionRunsMillis which is described as: The number of milliseconds to sleep between runs of the idle object evictor thread.…
Wand Maker
  • 18,476
  • 8
  • 53
  • 87
16
votes
2 answers

Increase load and decrease performance while replace DBCP to Tomcat JDBC-pool

After problems with connection leak and deadlocks in DBCP we made a decision to replace it with Tomcat JDBC-pool. Of course migration was really simple. But after deploy it on a production environment I noticed, that load on a server with running…
Dzinek
  • 786
  • 7
  • 17
14
votes
4 answers

Is DBCP (Apache Commons Database Connection Pooling) still relevant?

The JDBC 3.0 spec talks about Connection (and Prepared Statement) pooling. We have several standalone Java programs (i.e. we are not using an application server) that have been using DBCP to provide connection pooling. Should we continue to use…
jdigital
  • 11,926
  • 4
  • 34
  • 51
14
votes
4 answers

Logging in DBCP

I'm using Apache Commons DBCP. There is a task to track the inner behavior of the DBCP - number of active and idle connections. I found out that DBCP lacks any such logging at all. Yes, tt is possible to write the code that outputs the status of…
kachanov
  • 2,696
  • 2
  • 21
  • 16
13
votes
3 answers

SELECT 1 from DUAL: MySQL

In looking over my Query log, I see an odd pattern that I don't have an explanation for. After practically every query, I have "select 1 from DUAL". I have no idea where this is coming from, and I'm certainly not making the query explicitly. The…
biggusjimmus
  • 2,706
  • 3
  • 26
  • 31
12
votes
1 answer

DBCP: removeAbandoned VS eviction

I fail to figure out the difference between removeAbandoned and eviction. I read somewhere that removeAbandoned was deprecated, but it is not mentionned anywhere in the official doc (http://commons.apache.org/dbcp/configuration.html). So, if someone…
Mathieu
  • 1,638
  • 2
  • 27
  • 50
12
votes
4 answers

Concurrent use of same JDBC connection by multiple threads

I'm trying to better understand what will happen if multiple threads try to execute different sql queries, using the same JDBC connection, concurrently. Will the outcome be functionally correct? What are the performance implications? Will thread A…
11
votes
1 answer

DBCP and Hibernate on Spring, doesn't re-open dead connections, why?

I'm using Hibernate and DBCP to manage mySQL connections, all in a Spring project. Everything is working fine. The only problem is that if the app stays still for a long time, it will throw a an exception because the connection is dead (same thing…
gotch4
  • 13,093
  • 29
  • 107
  • 170
11
votes
2 answers

How to specify schema for SQL Server in JDBC Spring configuration

We are using the org.apache.commons.dbcp.BasicDataSource as parent class for our datasources in Spring. Is it possible to specify which schema to use in either the "url" or in another property in the DBCP datasource?
Andreas Selenwall
  • 5,705
  • 11
  • 45
  • 58
11
votes
1 answer

How to track/log connections in tomcat dbcp pool and detect code that does not return connection to the pool

Somewhere in a large application, there is some piece of code that does not return a connection to the connection pool as it should. The result is that that the pool reaches quickly the maximum connections. This can be worked around by setting it to…
10
votes
1 answer

Monitoring DBCP2 connection pool with JMX

I read from DBCP2 documentation that this new version supports JMX monitoring for connection pool, but I couldn't find any example which shows actual usage. I have a simple JDBC based java application which uses dbcp2 to create a connection pool…
Adib Souly
  • 101
  • 1
  • 4
10
votes
2 answers

Multithreading with Apache DBCP

My application executes multiple queries in multiple threads. Right now I am creating new connection for every query and I want to use pool to improve efficiency. Can Apache DBCP pool work in multiple threads simultaneously, or it will "block" on…
1
2
3
26 27