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
326
votes
15 answers

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 DBCP - http://commons.apache.org/dbcp/ C3P0 - http://sourceforge.net/projects/c3p0 I've read a lot about them…
Dema
  • 6,867
  • 11
  • 40
  • 48
114
votes
21 answers

How to fix: "No suitable driver found for jdbc:mysql://localhost/dbname" error when using pools?

I am trying to create a connection to my database, when I put test my code using the main method, it works seamlessly. However, when trying to access it through Tomcat 7, it fails with error: No suitable driver found for…
Tamer
  • 1,724
  • 4
  • 16
  • 15
89
votes
4 answers

DBCP - validationQuery for different Databases

I use DBCP pool and I want use testOnBorrow and testOnReturn to test if connection is still valid. Unfortunately I have to set property validationQuery to make it work. Question: What value should be in validationQuery? I know, that: validationQuery…
bugs_
  • 3,544
  • 4
  • 34
  • 39
72
votes
6 answers

tomcat-dbcp vs commons-dbcp

It seems there is a lot of confusion between these two connection pooling libraries. What I want to know is which one is better (if at all)? Here are some points which I would like to put up... Could someone please verify? Tomcat DBCP: uses the…
rabbit
  • 721
  • 1
  • 6
  • 3
71
votes
4 answers

Java JDBC connection pool library choice in 2011/2012?

Which JDBC connection pool library should I use for a new application project (not web application)? Apache DBCP has enough unresolved issues which are pushed until 2.0 I think. C3P0 development seems to be stopped. And both of them looks…
Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
44
votes
4 answers

Spring JDBC connection pool best practices

I have a basic Spring JDBC application with a pretty basic configuration:
Luciano Fiandesio
  • 10,037
  • 10
  • 48
  • 56
37
votes
1 answer

Difference between BasicDatasource and PoolingDatasource

What is the difference between org.apache.commons.dbcp BasicDatasource and PoolingDataSoure? Do both support pooling of connections? When to use each of them ?
sam
  • 651
  • 3
  • 9
  • 16
37
votes
7 answers

Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented

I am trying to configure dbcp2 with postgres 9.1 When I run my app, it throws exception: Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException:…
janetsmith
  • 8,562
  • 11
  • 58
  • 76
30
votes
6 answers

How good is Oracle Universal Connection Pool (UCP)

Does anybody have experience with using Oracle UCP under real production load? Does it handle database reconnects well? Are there any multi-threading issues? Has anybody compared it with C3P0 or Apache DBCP?
28
votes
11 answers

Apache Commons DBCP connection object problem, Thread: ClassCastException in org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper

I am using Apache Commons DBCP (commons-dbcp.jar) Connection pool. Once I obtained a connection from the pool it is wrapped in the class org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper. My requirement is to pass an array of…
Prodigy
  • 281
  • 1
  • 3
  • 3
25
votes
2 answers

Connection Pooling with Apache DBCP

I want to use Apache Commons DBCP to enable connection pooling in a Java Application (no container-provided DataSource in this). In many sites of the web -including Apache site- the usage of the library is based in this snippet: BasicDataSource ds =…
Carlos Gavidia-Calderon
  • 7,145
  • 9
  • 34
  • 59
24
votes
5 answers

Using encoded password for the datasource used in spring applicationContext.xml

I want to keep encoded password in my below mentioned springApplicationContext.xml Is there any way to achieve this? presently I have configured all properties using property-placeholder as shown below but the raw password is still open in my…
22
votes
1 answer

how to return connection to pool

do we need to call any method on dbcp.BasicDataSource or jndi datasource(i'm using jboss) to return the connection after done with it?
user920420
  • 221
  • 1
  • 2
  • 4
21
votes
4 answers

Postgres Error method org.postgresql.jdbc.PgConnection.createClob() is not implemented

When I invoke createClob method using connection object as shown below: Clob clob = con.createClob(); Following exception is thrown: Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgConnection.createClob() is not…
Nirav Patel
  • 1,304
  • 2
  • 13
  • 30
21
votes
4 answers

Safely Wrapping a Connection Pool

I am trying to implement row level security so our application can enforce more stringent access control. One of the technologies we are looking into is Oracle's Virtual Private Database, which allows row level security by basically augmenting all…
TheNorthWes
  • 2,661
  • 19
  • 35
1
2 3
26 27