connection-pooling

spring/tomcat-jdbc pool - new connection listener

◇◆丶佛笑我妖孽 提交于 2019-12-21 05:34:12
问题 I am using tomcat-jdbc pool in default spring-boot setup. I would like to run some custom Java code each time new JDBC connection is established in the pool and before it is used for the first time. How to do it, and if there are several possibilities which one is the best? 回答1: Well, I can think of two options: Create your own wrapper class - either by extending Tomcat's DataSource class or by implementing Java's DataSource interface and delegating to the wrapped DataSource - and then add

Managing SQL Server Connections

我是研究僧i 提交于 2019-12-21 04:38:06
问题 What is the the best practice for SQL connections? Currently I am using the following: using (SqlConnection sqlConn = new SqlConnection(CONNECTIONSTRING)) { sqlConn.Open(); // DB CODE GOES HERE } I have read that this is a very effective way of doing SQL connections. By default the SQL pooling is active, so how I understand it is that when the using code ends the SqlConnection object is closed and disposed but the actual connection to the DB is put in the SQL connection pool. Am i wrong about

Really need a db connection pool for unicorn rails?

爷,独闯天下 提交于 2019-12-21 04:35:15
问题 I can't find any document describing database connection pooling effect for unicorn. Unicorn forks several worker processes. I configured prefork and it's critical not to share database connections between workers, so I reset db connections after fork. My rails application has 8 workers per server, and the pool size in database.yml is 5, then I saw 45 connections to mysql. Each worker is single-threaded that handles 1 request at a time. SQL queries should be blocking. Seems the other 4

ADO.NET SQLServer: How to prevent closed connection from holding S-DB lock?

谁都会走 提交于 2019-12-21 04:15:26
问题 i Dispose an SqlConnection object, but of of course it isn't really closed. i need closed connection to not hold locks on database objects. How can i prevent closed connections from holding locks? Explanation of the above sentance for those who don't know: When you close an ADO or ADO.NET connection, you aren't actually severing the connection to SQL Server. The ADO/ADO.NET infrastructure keeps the connection around in case you want to use it again. The connections are kept lingering around

Why do I constantly see “Resetting dropped connection” when uploading data to my database?

我怕爱的太早我们不能终老 提交于 2019-12-21 03:08:17
问题 I'm uploading hundreds of millions of items to my database via a REST API from a cloud server on Heroku to a database in AWS EC2. I'm using Python and I am constantly seeing the following INFO log message in the logs. [requests.packages.urllib3.connectionpool] [INFO] Resetting dropped connection: <hostname> This "resetting of the dropped connection" seems to take many seconds (sometimes 30+ sec) before my code continues to execute again. Firstly what exactly is happening here and why?

JDBC Connection pool not reopening connections in Tomcat

天涯浪子 提交于 2019-12-20 21:01:11
问题 I have set up Tomcat to use a connection pool yet after the MySQL timeout on connections the connections previously open in the pool are not opened. Here is what my context.xml file looks like: <Resource name="jdbc/hpsgDB" auth="Container" type="javax.sql.DataSource" maxActive="5" maxIdle="3" maxWait="10000" username="uname" password="password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/hpsgdb?autoReconnect=true"/> As you can see I have included autoReconnect as

Connection Pooling with PostgreSQL JDBC

痞子三分冷 提交于 2019-12-20 19:35:31
问题 Recently I downloaded the JDBC driver for PostgreSQL from here. Since I'm using Java 1.7 JVM and it's written: If you are using the 1.6 or 1.7 JVM, then you should use the JDBC4 version. I download JDBC4. The problem is there exist no PoolingDataSource's in it. If you get JDBC3 you can use org.postgresql.jdbc3.Jdbc3PoolingDataSource or others as is seen here. Is there any pooling DataSource in JDBC4 that I don't know about, or what should I use instead? The only thing I found in JDBC4 is

JDBC fundamental concepts, Pooling and Threading

你离开我真会死。 提交于 2019-12-20 10:26:08
问题 I was always using JDBC in JavaSE on single-threaded environment. But now I need to use a connection pool and let many threads to have interaction with the database (MSSQL and Oracle) and I am having a hard time trying to make it as it seems that I am lacking some fundamental undestanding of the api. AFAIK after connect and logging a Connection represents a phisical tcp/ip connection to the database. It creates Statement (s) that can be seen as SQL interaction(s) with the database over the

What really is connection pooling?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 09:53:47
问题 I have heard the term connection pooling and looked for some references by googling it... But can't get the idea when to use it.... When should i consider using connection pooling? What are the advantages and disadvantagesof connection pooling? Any suggestion.... 回答1: The idea is that you do not open and close a single connection to your database, instead you create a "pool" of open connections and then reuse them. Once a single thread or procedure is done, it puts the connection back into

How Jedis Pool works?

和自甴很熟 提交于 2019-12-20 09:27:18
问题 I'm using Jedis pool to manage connections to Redis server. An example code of mine as follows: public Set<String> getTopArticleList(int start, int end) { Set<String> list = null; Jedis j = JedisFactory.getInstance().getJedisPool().getResource(); Pipeline pipe = j.pipelined(); try { // do stuff with redis pipe.sync(); } catch (JedisConnectionException jex) { JedisFactory.getInstance().getJedisPool().returnBrokenResource(j); } finally { JedisFactory.getInstance().getJedisPool().returnResource