apache-commons-dbcp

Refresh DataSource using Spring+dbcp

青春壹個敷衍的年華 提交于 2019-12-10 11:26:51
问题 I'm using Spring with DBCP and need to refresh my datasource when some configuration on operation environment changes, without restart all application. If I do it with no use of DBCP, I force this refresh closing current opened datasource in use and Start a new instance of DataSource. Using DBCP+Spring, I can't do that. Somebody knows if it is possible? 回答1: I don't think there is such a support in plain DBCP, mostly because database connection properties are very rarely changing during the

DBCP Connection properties

久未见 提交于 2019-12-08 13:02:10
问题 We are having hard time figuring out the properties defined, minIdle , maxIdle etc. we are seeing the following error with the following setting InitialSize=5 maxActive=50 maxIdle=40 maxWait=2000 Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object at org.springframework.jdbc.datasource.DataSourceUtils.getConnection

Same old story: Tomcat DBCP + MySQL, MySQLNonTransientConnectionException: No operations allowed after connection closed

爱⌒轻易说出口 提交于 2019-12-08 12:17:21
问题 I examined related questions here on this topic, and also googled for some time. Still seems I don't understand something crytical in Tomcat's DBCP configuration or mechanics. I got Tomcat 6, DBCP resource configured in server.xml : <Resource name="jdbc/myDB" auth="Container" description="Database connection" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://myhost:3306/mydb?autoReconnectForPools=true&useUnicode=true" username="user" password="password"

How to Create Data Source without Pooling in Tomcat

≯℡__Kan透↙ 提交于 2019-12-08 06:32:53
问题 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&connectTimeout=5000&socketTimeout=5000" zeroDateTimeBehavior="convertToNull" username="dbuser" password="password" maxActive="100" maxWait="2" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" /> By default, Tomcat will use

Remote connection to a H2 database in server mode with DBCP pooling

时光毁灭记忆、已成空白 提交于 2019-12-08 03:29:58
问题 I'm trying to create an embedded H2 server which I could also access remotly and also use Tomcat DBCP Pooling. Here is my code to produce the dataSource : @Produces @ApplicationScoped public DataSource getDataSource() throws NamingException, SQLException { dataSource = new BasicDataSource(); dataSource.setDriverClassName("org.h2.jdbcx.JdbcDataSource"); dataSource.setUrl("jdbc:h2:/tmp/myapp"); dataSource.setUsername("sa"); dataSource.setPassword(""); dataSource.setMaxActive(100); dataSource

How to Create Data Source without Pooling in Tomcat

余生颓废 提交于 2019-12-07 07:26:26
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&connectTimeout=5000&socketTimeout=5000" zeroDateTimeBehavior="convertToNull" username="dbuser" password="password" maxActive="100" maxWait="2" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" /> By default, Tomcat will use DBCP data source factory and created pooling data sources. The specific database and driver we use

Connection Pool Issue with MySQL using Hibernate and Apache DBCP

痴心易碎 提交于 2019-12-06 14:22:43
Seems to be an issue with my application. When ever the application is idle for a very long time ( am not sure the exact timing ) upon launching I get following error message in my logs. I am using Spring+Hibernate+MySQL and ApacheDBCP for connection pooling ERROR [org.hibernate.util.JDBCExceptionReporter]The last packet successfully received from the server was 74,188,684 milliseconds ago. The last packet sent successfully to the server was 74,188,685 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection

Refresh DataSource using Spring+dbcp

℡╲_俬逩灬. 提交于 2019-12-06 11:07:46
I'm using Spring with DBCP and need to refresh my datasource when some configuration on operation environment changes, without restart all application. If I do it with no use of DBCP, I force this refresh closing current opened datasource in use and Start a new instance of DataSource. Using DBCP+Spring, I can't do that. Somebody knows if it is possible? I don't think there is such a support in plain DBCP, mostly because database connection properties are very rarely changing during the lifetime of the application. Also you will have to consider transition time, when some connections served by

DBCP Idle Connections not being reused in Camel Route

ぐ巨炮叔叔 提交于 2019-12-06 06:31:47
问题 I am pretty sure the idle connections are not being re-used or I am leaking connections. I have a simple route that start from a file consumer. The file consumer consumes text files. After picking up the file I check a table to ensure that this is not a duplicate file. I then convert the message body from a file to string. I then split the file up and run the individual pieces through a route depending on what type of record it is. Each one of these routes eventually inserts this record into

Does DBCP connection pool connection.close() return connection to pool

老子叫甜甜 提交于 2019-12-06 02:33:01
问题 Using BasicDataSource from DBCP if we do a getConnection() and in the finally block we close the connection does it really return the connection to the pool or does it close the connection. The snippet code I am checking is this try { Connection conn1 = getJdbcTemplate().getDataSource() .getConnection(); //Some code to call stored proc } catch (SQLException sqlEx) { throw sqlEx; } finally { try { if (conn != null) { conn.close(); } } catch (SQLException ex1) { throw ex1; } } I was checking