dbcp

Prepared statement 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 specific prepared statements be defined after that? Right now, I'm only using a PoolingDataSo...

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 DBCP, or can we take advantage of the JDBC-provided pooling and get rid of DBCP? We are usi...

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 DBCB - http://commons.apache.org/dbcp/ C3P0 - http://sourceforge.net/projects/c3p0 I've read a lot about them in blogs and other forums but could not reach a decision. Is there any relevant altern...

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 c3po after reading several posts on Stackoverflow shooting down DBCP ), is it ok to use ...

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 log basically looks like this: 10 Query SELECT some normal query 10 Query...

Why use Tomcat's context.xml files to declare DBCP resources?

Im having trouble understanding why I would use a context.xml file to declare a resource, in my case a database connection pool. Hopefully I've got my facts straight in the following arguments against using context.xml As far as I can tell, resources declared in /META-INF/context.xml are only available within the context, so there's no...

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? ...

How to shrink DB Connection Pool?

I am using Apache DBCP with JNDI in my tomcat container to pool connections to a mysql database. Everything works fine but a problem i am seeing is that once a pconnection is pooled it is never released. So after a load spike connection sit their forever sleeping. Is their a way to shrink the pool through context.xml parameters? here...

DBCP connection validation problem

I decided to use DBCP mainly because I was getting timeouts on my database connections. In theory, once you define a "validation query", DBCP will by default run that query on the connection before using it, so you always know the connection is OK. I set it up two weeks ago and it seemed to work. However, last night I got a timeout exce...

How to Create Data Source without Pooling in Tomcat

I use JNDI context to create datasource for JDBC drivers in Tomcat's context.xml file like this, <Resource name="db/test" type="javax.sql.DataSource" driverClassName="com.test.jdbc.Driver" url="jdbc:fastdb://localhost:3306/session_db?autoReconnect=true&amp;connectTimeout=5000&amp;socketTimeout=5000" ...

Setting DB2 Client Audit information with a dbcp connection pool in a Java app

I'm developing Java apps on Tomcat 5.5 using JNDI to connect to shared dbcp connection pools with JDBC 3.0 drivers and DB2 8 on zOS and also DB2 9 on LUW. In my app, I use org.springframework.jndi.JndiObjectFactoryBean to get the dataSource and feed it into an org.springframework.jdbc.core.simple.SimpleJdbcTemplate to run the queries. ...

unable to update CLOB using DBCP connection

Am trying to do update a clob column using a connection object that is retrieved using Apache DBCP connection pooling. Earlier, I've implemented connection pooling using this and it was working fine i.e am able to update CLOB. I switched to DBCP because I was getting java.sql.SQLException: ORA-01000: maximum open cursors exceeded. I've ...

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 datasource as a bean in Spring. We are using Hibernate for ORM. We are getting errors occasional...

Hibernate, C3P0, Mysql Connection Pooling

Hi all, I recently switched from Apache DBCP connection pooling to C3P0 and have gone through my logs to see that there are connection timeout issues. I haven't had this in the past with DBCP and Tomcat, so I'm wondering if it is a configuration issue or driver issue. Whenever I load a page after the server has been idle for a while, ...

Get number of free connections in connection pool

In my project Spring manages connection pool with org.apache.commons.dbcp.BasicDataSource class. Is possible to get how many connections are free or used in current time? Thanks. ...

GWT eclispe embedded jetty and DBCP connection pooling

Hi all, I am trying to setup the embedded Jetty that comes with the GWT (2.0.3) Eclipse plugin to use a JNDI connection pool that works perfectly under Tomcat, without success. Now since i have read some things regarding the issue, i have managed to do the following: Included the Jetty naming initial context factory to the classpath by ...

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? ...

dbcp having problems returning connections when database is unavailable

I found the following link by erickson dated jan 29, 2009: http://stackoverflow.com/questions/490288/is-dbcp-apache-commons-database-connection-pooling-still-relevant/490358#490358 "DBCP has serious flaws. I don't think it's appropriate for a production application, especially when so many drivers support pooling in their DataSource na...

OSGI & Apache Commons-DBCP Classloading Issue

I inherited some code that is using the Apache commons-dbcp Connection pools in an OSGi bundle. This code works fine with Eclipse/Equinox OSGi version 3.4.3 (R34x_v20081215), commons-dbcp 1.2.2 and the postgres jdbc3 8.3.603 bundles from springsource.org. I wanted to modernize, maybe this was my first mistake! When I use the new versio...

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 non-default pool. At least non but having used DBCP before. The upgrade went pretty much...