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
5
votes
1 answer

Connection pools and releasing temporary tables on return

I'm using MySQL's temporary tables with connection pooling. Normally, temporary tables created in a session stay in that session and are dropped when the connection is closed. However, since I'm using connection pooling and physical connections…
antak
  • 19,481
  • 9
  • 72
  • 80
5
votes
1 answer

Pooling PreparedStatement on Tomcat with MySQL

When using Tomcat with MySQL, what is the relationship between poolPreparedStatements setting in Tomcat DataSource configuration (I believe coming from DBCP) and Connector/J cachePrepStmts setting? What's the optimal configuration?
ykaganovich
  • 14,736
  • 8
  • 59
  • 96
5
votes
1 answer

How to uniquely name an object

I have a simple webapp that acquires connection from tomcat JDBC datasource. To track the connection usage, I'm planning to implement logging while opening and closing connection. The logging supposed to print something like…
Raja Anbazhagan
  • 4,092
  • 1
  • 44
  • 64
5
votes
2 answers

Auto Reconnect of Database Connection

I have a DBCP connection pool in Tomcat. The problem is that when the connection is lost briefly the appliction is broken because DBCP won't try to reconnect again later when there is a connection. Can I get DBCP to reconnect automatically?
wesley
  • 51
  • 1
  • 1
  • 2
5
votes
3 answers

apache commons dbcp connection pool error: Timeout waiting for idle object in a Spring + Hibernate app using Spring Transactions

I have read through various Stackover flow Questions and contents on the web on similar problem. However, I couldnt find useful hints that would allow me to narrow down on my problem. Here is my usecase which results in this error. 2 entities…
Dhwanit
  • 153
  • 1
  • 4
  • 10
5
votes
2 answers

Reconnecting to a postgres database after postgres restart from Java

I'm using postgres 9.1, org.apache.commons.dbcp.BasicDataSource (for my connection pool) and Java 1.7. When I restart my postgres server, I get exceptions like org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator…
three-cups
  • 4,375
  • 3
  • 31
  • 41
5
votes
1 answer

MysqlConnectionPoolDataSource or c3p0 like library?

What's the difference between MysqlConnectionPoolDataSource and C3p0, BoneCP or dbcp library for connection pooling? I don't understand why use a library if mysql connector give connection pooling.
5
votes
3 answers

How to preinitialize DBCP connection pool on startup?

The setup of my project is - Spring JDBC for persistence Apache DBCP 1.4 for connection pooling Mysql 5 on Linux Here is the log of my application that captures the interactions with the database. 2013-01-29 15:52:21,549 DEBUG…
5
votes
4 answers

Tomcat error: java.sql.SQLException: No suitable driver found for jdbc:sqlserver://

I have a terrible problem with Tomcat, well terrible because of this problem I've thrown away the project for more than a month now... Yet I'll still need to solve it and to go on with the project... So it's throwing me this…
Arturas M
  • 4,120
  • 18
  • 50
  • 80
5
votes
1 answer

How commons dbcp (and other connection pools) manage open statements and resultsets?

Specifically, when I return a connection to the pool, does dbcp (and other connection pools) close the statements and resultsets for me? Or should I be closing these myself?
4
votes
1 answer

How to set the max pool size or connection size for BasicDataSource in Spring Framework

I have a Spring application deployed in JBoss EAP server, using the following settings:
4
votes
2 answers

Spring 2.5 Could not get JDBC Connection

I'm using spring 2.5 SimpleJdbcTemplate to access MySQL db. When I try to access the DB too often(using Quartz to access it every minute) i get this stack trace: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC…
Evgeni Dimitrov
  • 21,976
  • 33
  • 120
  • 145
4
votes
4 answers

jdbc spring security, apache commons dbcp

In a Spring Security, I defined a jdbc auth manager:
AgostinoX
  • 7,477
  • 20
  • 77
  • 137
4
votes
1 answer

Implementing a connection recreation mechanism on periodic DB password change

We are using a PostgreSQL database with AWS RDS IAM authorization feature – which means that our application needs to refresh the authorization token every 10 minutes or so (since the token is valid for 15 minutes). This token is used as a database…
4
votes
1 answer

Tomcat webapp cannot use MySQL driver after redeploy

I am using commons-dbcp to do connection pooling for a MySQL database in a small Spring webapp which is deployed as a WAR file to a local Tomcat 6.0.28 container (installed using the Ubuntu package manager) using the Sun 1.6 JDK. The deploy is done…
matts
  • 6,738
  • 1
  • 33
  • 50