apache-commons-dbcp

Question regarding org.apache.commons.dbcp.BasicDataSource

半世苍凉 提交于 2019-12-21 05:42:14
问题 I fixed some bug related to the way we were using BasicDataSource and though I understand part of it I still have some questions unanswered :) Problem: The application was not able to auto-connect to the database after a db failure. Application is using org.apache.commons.dbcp.BasicDataSource class as a TCP-connection pool for a JDBC connection to Oracle db. Fix: After some research I discovered that in BasicDataSource testOnBorrow and testOnreturn were not set. I provided the validation

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

核能气质少年 提交于 2019-12-21 03:21:07
问题 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 yet implemented. at org.postgresql.Driver.notImplemented(Driver.java:659) at org.postgresql.jdbc.PgConnection.createClob(PgConnection.java:1246) at org.apache.commons.dbcp2.DelegatingConnection.createClob(DelegatingConnection.java:868) at org.apache

Difference between BasicDatasource and PoolingDatasource

◇◆丶佛笑我妖孽 提交于 2019-12-20 08:56:42
问题 What is the difference between org.apache.commons.dbcp BasicDatasource and PoolingDataSoure? Do both support pooling of connections? When to use each of them ? 回答1: BasicDataSource is, as the javadoc says, a one-stop shopping for basic needs. It has all the necessary. It creates internally a PoolableDataSource and an ObjectPool. PoolingDataSource implements the DataSource interface using a provided ObjectPool. PoolingDatasource take cares of whatever has to do with connections (casting,

Stored Proc slower from application than Management Studio

末鹿安然 提交于 2019-12-20 06:38:48
问题 We have a stored proc which runs pathetically when called from application (Spring - DBCP - jtds) infact timesout after 10 minutes, but runs in 30 seconds when executed from SQL Server Managament Stuido. Can someone provide leads into this issue? 回答1: This normally indicates a parameter sniffing issue. See Slow in the Application, Fast in SSMS? Understanding Performance Mysteries for details. 来源: https://stackoverflow.com/questions/7504273/stored-proc-slower-from-application-than-management

Deadlock issue in DBCP deployed on Tomcat

不羁的心 提交于 2019-12-18 14:16:59
问题 I'm using DBCP data source (with default configuration) in Spring configuration to manage my connections to the database, and I'm running into a deadlock condition when the number of clients increase. I found that there is a deadlock issue in DBCP 1.2.1 which I was using, which was supposed to be resolved in 1.4. So I upgraded to 1.4, but the issue still persists. In the thread dump, there are many threads blocked with the following stack trace on top: java.lang.Thread.State: WAITING on org

SELECT 1 from DUAL: MySQL

六月ゝ 毕业季﹏ 提交于 2019-12-18 12:26:09
问题 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 select 1 from DUAL 10 Query SELECT some normal query 10 Query select 1 from DUAL 10 Query SELECT some normal query 10 Query select 1 from DUAL 10 Query SELECT some normal query

DBCP returns closed connections

可紊 提交于 2019-12-18 03:00:04
问题 We are seeing situations where our database connection from org.apache.commons.dbcp.BasicDataSource is dying with socket write errors: com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error All subsequent attempts to write to the connection fail, of course: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. After updating the code to catch such exceptions and request a new connection when it occurs, it failed again. Am I correct

Is DBCP (Apache Commons Database Connection Pooling) still relevant?

此生再无相见时 提交于 2019-12-17 18:27:15
问题 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 using MySQL (Connector/J) and will eventually be adding SQL Server support (jTDS); it's unlikely that we'll support any other databases. EDIT: See comment below

DBCP - validationQuery for different Databases

纵饮孤独 提交于 2019-12-17 03:22:38
问题 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 must be an SQL SELECT statement, that returns at least one row. Problem is that we use various databases (DB2, Oracle, hsqldb). 回答1: There is not only one validationQuery for all databases. On each database you have to use different

How to fix: “No suitable driver found for jdbc:mysql://localhost/dbname” error when using pools? [duplicate]

六月ゝ 毕业季﹏ 提交于 2019-12-16 19:57:39
问题 This question already has answers here : The infamous java.sql.SQLException: No suitable driver found (13 answers) Closed 2 years ago . 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 jdbc:mysql://localhost/dbname. I am using pooling. I put in mysql connector (5.1.15), dbcp (1.4) , and pool(1.4.5) libraries in WEB-INF/lib