connection-pooling

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

ZeroMQ multithreading: create sockets on-demand or use sockets object pool?

拜拜、爱过 提交于 2019-12-06 02:32:17
I'm building a POC leveraging ZeroMQ N-to-N pub/sub model. From our app server, when a http request is serviced, if the thread pulls data from the database, it updates a local memcache instance with that data. To synchronize other memcache instances in the app server cluster, the request thread sends a message with the data using a ZMQ publisher...so the question is: What strategy is the most effective with respect to minimizing socket create/destory overhead when the application has many threads that depend on sockets for sending messages? Do we share a pool of sockets, do we create/destroy

Connection Pooling using Jetty, in Oracle

久未见 提交于 2019-12-06 00:30:29
问题 I am trying to implement the concept of ConnectionPooling in Oracle using Jetty server. I have tried the following that I saw on a tutorial. It is working if I deploy using Tomcat server, but Jetty seems to be giving me an unusual error . Details are below - I have a class called TestServlet.java defined as - import java.io.IOException; import java.sql.*; import javax.naming.*; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; import javax.sql

When should I use connection pooling with MySQL in NodeJS

自古美人都是妖i 提交于 2019-12-06 00:17:03
问题 Working with the Node-MySql module: From my understanding multithreaded programs benefit more from pooling connections than singlethreaded ones. Is this true? And if this logic proves true, what scenario is connection pooling beneficial in a Node.JS application? 回答1: Whether single or multithreaded, pooling can still be beneficial in allowing open connections to be reused rather than being closed only to open another immediately after: When you are done with a connection, just call connection

closing SQLDataReaders - how to tell if they are closed?

怎甘沉沦 提交于 2019-12-05 23:40:57
I'm finding that I'm having some website connection pool issues and I'm in the process of tracking them down. I know one thing to look for is to make sure that any SQLDataReaders get closed and I've gone though and made sure they are. One question that popped up in my head was about methods that return SQLDataReaders and how they get closed (or not). So here's how I have things setup and some example methods: public static SqlDataReader ExecuteReader(SqlCommand cmd) { SqlConnection c = new SqlConnection(Properties.Settings.Default.DatabaseConn); cmd.Connection = c; c.Open(); return cmd

Tomcat: javax.naming.NoInitialContextException

耗尽温柔 提交于 2019-12-05 19:44:19
I have a webservice with Java Servlets on a Tomcat server. In my Servlet I use a database pool like this: envContext = new InitialContext(); DataSource ds = (DataSource) envContext.lookup( "java:/comp/env/jdbc/Database" ); con = ds.getConnection(); For initialisation I have this in my web.xml: <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/Database</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> Then there is the context.xml which seems to be the important step here: <?xml version="1.0" encoding="UTF-8"?> <!--

Why would moving our .NET /SQL Server website to a new host cause connection pool size to be exceeded?

别说谁变了你拦得住时间么 提交于 2019-12-05 19:11:48
We've recently moved our company website to a new host. It is an ASP.NET site with C# code behind, connecting to MS SQL server. Since moving the site to the new server, the site is exceeding the connection pool limit (which is not set explicitly, so I believe is at the default size of 100). Inspection of the open processes via SQL Server Management Studiorevealed that every database call appeared to be left open, and indeed, in the code I can find no explicitly closed connections at all. The database connections are made in the following way: DSLibrary.DataProviders.SqlProvider db = new

How to resolve “Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL”

不想你离开。 提交于 2019-12-05 17:57:51
Firstly I want to say that i checked all answers at stackoverflow, and i can't fix this bug! Help me please! I spend a lot of time, but no result. I'm trying to create connection pool using Tomcat8. I have an exception: java.sql.SQLException: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql:/localhost:3306/autopark' at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2160) at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2032) at org.apache.tomcat.dbcp.dbcp2.BasicDataSource

Connection Pooling

六月ゝ 毕业季﹏ 提交于 2019-12-05 17:23:08
I have the following code, If I use conn == null in finally do I still use connection pooling? I know it is a good practice to close your connection but how about disposing the whole connection object? public void ExecuteNonQuery(SqlCommand Cmd) { //========== Connection ==========// SqlConnection Conn = new SqlConnection(strConStr); try { //========== Open Connection ==========// Conn.Open(); //========== Execute Command ==========// Cmd.Connection = Conn; Cmd.CommandTimeout = 180; Cmd.ExecuteNonQuery(); } catch (Exception Exc) { throw Exc; } finally { //======== Closing Connection ========//

Active Azure Sql Connections are over the connection pool limit

百般思念 提交于 2019-12-05 17:16:59
问题 We fight the issue in production when once in a while our Azure SQL database performance significantly degrades. We know we have locks on one of the tables, but these locks are not deadlocks, they are long locks and in an hour or so the performance returns to normal. We are trying to find all the possible scenarios on how we get these long locks (every query is super fast and all performance analyzers could show us what causes long locks). The reason for this question is the picture below: