apache-commons-dbcp

In the java DBCP connection pool - what is an idle connection?

人走茶凉 提交于 2019-12-13 14:10:13
问题 A colleague at work insists that a DBCP idle connection is a connection that has lain unused for 30 minutes. I believe a dbcp idle connection is a connection that is in the pool available to be borrowed, and an active connection is one that is borrowed. Looking through the code I found no reference to 30 minutes or other magic values and a cursory glance through the code for assuring minidle does not show any such logic. If he is correct can you please back that up with a code or

choose a db connection pool

流过昼夜 提交于 2019-12-13 05:19:41
问题 we want to use a db connection pool in our applicationl,however thear are so many open soure pools,like dbcp,c3p0,proxool and etc. I have no idea which is better,any one have some experience about them? 回答1: I'd recommend using the one that is built into your Java EE app server if you're using one. That's should be sufficient. Why add another dependency? I'd recommend using DBCP from Apache. It'll work just fine for your purposes. 回答2: As author of BoneCP (http://jolbox.com), I invite you to

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

China☆狼群 提交于 2019-12-12 13:40:19
问题 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 able to find the replacement configuration. I use commons-dbcp library and Spring classes like SimpleJdbcCall etc. I never deal with low level JDBC API, however if the vendor code needs its real Connection type (Oracle) the nativeJdbcExtractor

Auto Reconnect of Database Connection

爱⌒轻易说出口 提交于 2019-12-12 10:55:45
问题 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? 回答1: There are 2 ways to "solve" this, though both have some issues: You can use a "validationQuery" (see below) to have a test query run before you go (generally something like 'select 1 from dual' which will be used to test connections before/after you

Tomcat Connection Pooling - java.lang.UnsupportedOperationException: Not supported by BasicDataSource

蓝咒 提交于 2019-12-12 02:55:23
问题 I have tried C3po library for connection pooling but I am gettting errors such as abstractMethodError() for my code I then decided to go with the tomcat pooling thing. Now I am getting an java.lang.UnsupportedOperationException: Not supported by BasicDataSource at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1062) at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:139) at org

Java code to get lost active DB Connection back to the connection pool

与世无争的帅哥 提交于 2019-12-11 23:43:39
问题 I am facing connection leakage problem with DBCP2. I went though all the code base and have closed/released the connections wherever required. I have also run Sonar, but no connection leakages were reported. Finally I have decide to write a java based executor service which will close or return the DB connections back to the pool periodically. The service should run once in 2 days. Can someone help with the code to close the connections which are not returned to pool? 来源: https:/

JDBC connection leak on JDBC pool when using AQ

不想你离开。 提交于 2019-12-11 12:20:41
问题 We are using the Oracle AQ support from spring-data to have both JMS and JDBC over the same datasource, with local transactions instead of XA. The big picture of our setup is basically what is described in the reference manual:on the orcl:aq-jms-connection-factory: use-local-data-source-transaction="true" and native-jdbc-extractor="oracleNativeJdbcExtractor" HibernateTransactionManager (I am trying to use single DataSource(DBCP2 basic datasource) now for AQ and Hibernate).I am using camel JMS

javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory

孤街醉人 提交于 2019-12-10 22:16:55
问题 I'm trying to establish a connection to an Oracle database using BasicDataSource using DBCP. I downloaded commons-dbcp-1.4-bin.zip from here. There are three jar files on the classpath. commons-dbcp-1.4 commons-dbcp-1.4-sources commons-dbcp-1.4-javadoc I'm using the following code for the connection to be established. import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.commons.dbcp.BasicDataSource; public

jdbc spring security, apache commons dbcp

偶尔善良 提交于 2019-12-10 15:34:13
问题 In a Spring Security, I defined a jdbc auth manager: <security:authentication-manager> <security:authentication-provider> <security:jdbc-user-service data-source-ref="securityDataSource"/> </security:authentication-provider> </security:authentication-manager> <bean id="securityDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="org.postgresql.Driver"/> <property name="url" value="jdbc:postgresql://127.0.0.1:5432/mydb"/> .

First Login: HTTP Status 500 - Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException

僤鯓⒐⒋嵵緔 提交于 2019-12-10 11:40:51
问题 I have made a Java webapp with Spring, Hibernate and MySQL. It runs correctly, but in the first attempt to connect, I have the following error: HTTP Status 500 - Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed: type Exception report message Request processing failed; nested exception is org.springframework