apache-commons-dbcp

Is the factory attribute for tomcat's server.xml required?

半城伤御伤魂 提交于 2020-08-02 07:48:28
问题 I have been reading more on JNDI in tomcat and I have read from multiple resources that the factory attributed is required. They say its often supposed to be " org.apache.tomcat.jdbc.pool.DataSourceFactory ". However, most often I see something like this - <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/javatest

Is it ok to use same BasicDataSource, Connection, Statement and ResultSet Object in multiple class methods.?

梦想的初衷 提交于 2020-04-30 14:00:19
问题 I have below code which uses static objects of BasicDataSource, Sql Connection, Statement and ResultSet. The code below is working fine, but i just want to know about the safety of using these kinds of coding practices. or how can i optimize the below code so that it can become more stable and can reliable. public class Testing { static BasicDataSource bds = DBConnection.getInstance().getBds(); static Connection con = null; static PreparedStatement stmt = null; static ResultSet rs = null;

Is it ok to use same BasicDataSource, Connection, Statement and ResultSet Object in multiple class methods.?

喜你入骨 提交于 2020-04-30 13:57:09
问题 I have below code which uses static objects of BasicDataSource, Sql Connection, Statement and ResultSet. The code below is working fine, but i just want to know about the safety of using these kinds of coding practices. or how can i optimize the below code so that it can become more stable and can reliable. public class Testing { static BasicDataSource bds = DBConnection.getInstance().getBds(); static Connection con = null; static PreparedStatement stmt = null; static ResultSet rs = null;

How to use Apache-Commons DBCP with EclipseLink JPA and Tomcat 7.x

不羁岁月 提交于 2020-01-15 12:44:17
问题 I've been working on a web application, deployed on Tomcat 7, which use EclipseLink JPA to handle the persistence layer. Everything works fine in a test environment but we're having serious issues in the production environment due to a firewall cutting killing inactive connections. Basically if a connection is inactive for a while a firewall the sits between the Tomcat server and the DB server kill it, with the result of leaving "stale" connections in the pool. The next time that connection

Monitoring for Commons DBCP?

早过忘川 提交于 2020-01-01 05:20:15
问题 A huge webapp in my Tomcat sometimes starts using too many DBCP connections, leading to problems. To investigate, I want to know precisely at each point in time what thread/method is holding a connection of the pool. Does not need to be real-time, post-mortem analysis is OK. I have been looking for such a DBCP monitoring tool, in vain, so I am about to write mine. (if there is any interest I can make it open source) Here is my plan: Modify PoolingDataSource.getConnection to log " DBCP+1

Connection Pooling with Apache DBCP

烂漫一生 提交于 2019-12-29 14:15:10
问题 I want to use Apache Commons DBCP to enable connection pooling in a Java Application (no container-provided DataSource in this). In many sites of the web -including Apache site- the usage of the library is based in this snippet: BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName("oracle.jdbc.driver.OracleDriver"); ds.setUsername("scott"); ds.setPassword("tiger"); ds.setUrl(connectURI); Then you get your DB connections through the getConnection() method. But on other sites -and

Connection Pooling with Apache DBCP

天涯浪子 提交于 2019-12-29 14:13:22
问题 I want to use Apache Commons DBCP to enable connection pooling in a Java Application (no container-provided DataSource in this). In many sites of the web -including Apache site- the usage of the library is based in this snippet: BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName("oracle.jdbc.driver.OracleDriver"); ds.setUsername("scott"); ds.setPassword("tiger"); ds.setUrl(connectURI); Then you get your DB connections through the getConnection() method. But on other sites -and

Using dynamic property in connection pooling service for ExecuteSQL processor

自古美人都是妖i 提交于 2019-12-23 23:20:06
问题 I am using ExecuteSQL to get the table from one or more database but i want to provide URL, Username, and password dynamically to the dbcpconnectionPool service so that i won't need more than one ExecuteSQL processor to retrieve data from different DB. It is found that controller service doesn't accept attribute from incoming flow file. So how to achieve it if it is possible. Someone pointed out that it can be achieved only by using rest api, if that is the case please provide a working

How to configure MySQL connection properties with Spring, Hibernate 3.3 and c3p0?

夙愿已清 提交于 2019-12-23 12:43:51
问题 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 without any problems so far. The only thing I can't get to work is passing properties to the underlying MySQL JDBC4Connection. Up to now, I used DBCP's

How to preinitialize DBCP connection pool on startup?

血红的双手。 提交于 2019-12-21 17:29:12
问题 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 http-bio-8080-exec-3 org.springframework.jdbc.core.JdbcTemplate - Executing SQL query [SELECT id from emp] 2013-01-29 15:52:21,558 DEBUG http-bio-8080-exec-3 org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 2013-01-29 15:52