connection-pooling

What is database pooling?

ε祈祈猫儿з 提交于 2019-11-28 02:40:31
I just wanted to know the concept of database connection pooling and how it is achieved. Database connection pooling is a method used to keep database connections open so they can be reused by others. Typically, opening a database connection is an expensive operation, especially if the database is remote. You have to open up network sessions, authenticate, have authorisation checked, and so on. Pooling keeps the connections active so that, when a connection is later requested, one of the active ones is used in preference to having to create another one. Refer to the following diagram for the

Getting org.hibernate.exception.JDBCConnectionException: could not execute query even through JNDI

我的梦境 提交于 2019-11-28 01:56:22
问题 I use Struts2+JSP+Tomcat6+Hibernate+Mysql as my J2EE application framework.Following to this topic, I've had the problem of getting this error: org.hibernate.exception.JDBCConnectionException: could not execute query It appears to be due to the fact that mysql closes it's connections after n hours. As people answered there I changed the hibernate config to get my db connections through JNDI.here is the course of actions which I've taken to do this: my hibernate.cfg.xml: <hibernate

Hibernate/MySQL Connection Timeout

半城伤御伤魂 提交于 2019-11-28 01:19:29
问题 I wrote a server-side application that powers a website and multiple mobile clients. I used Hibernate for data access. I later discovered that the app fails after a day! When I checked around online, I found out that its a well know issue with MySQL terminating a "stale" connection after 8 hours. In order to avoid this, I found many suggestions like including ?autoReconnect=true , using c3P0 , etc. Since autoReconnect is officially discouraged (especially in production environment) and also

Reset (autoCommit) on connection in HikariCP

混江龙づ霸主 提交于 2019-11-28 00:57:16
问题 I keep seeing this log when I use connections in Hikari pool. [com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314 [com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314 [com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset (autoCommit) on connection com.mysql.jdbc.JDBC4Connection@1c9b0314 [com.zaxxer.hikari.pool.PoolElf] : HikariPool-0 - Reset

.NET SqlConnection class, connection pooling and reconnection logic

旧城冷巷雨未停 提交于 2019-11-27 23:07:55
We have some client code which is using the SqlConnection class in .NET to talk to a SQLServer database. It is intermittently failing with this error: "ExecuteReader requires an open and available Connection. The connection's current state is Closed" The "temporary" solution is to reboot the process, after which everything works - however, that's obviously unsatisfactory. The code is keeping a cache of SqlConnection instances, one for each database. We'd like to re-write the code, but before I do, I need to know a few things: My first question is: Is it inefficient to repeatedly connect and

Using PreparedStatement pooling in dbcp

社会主义新天地 提交于 2019-11-27 22:28:02
问题 Can someone explain how exactly prepared connection pooling using dbcp can be used? (with some example code if possible). I've figured out how to turn it on - passing a KeyedObjectPoolFactory to the PoolableConnectionFactory. But how should the specific prepared statements be defined after that? Right now I'm only using a PoolingDataSource to get connections from the pool. How do I use the prepared statements from the pool? 回答1: Well talking about getting connection from the pool vs getting

Accessing a MySQL connection pool from Python multiprocessing

烂漫一生 提交于 2019-11-27 21:38:06
I'm trying to set up a MySQL connection pool and have my worker processes access the already established pool instead of setting up a new connection each time. I'm confused if I should pass the database cursor to each process, or if there's some other way to do this? Shouldn't MySql.connector do the pooling automatically? When I check my log files, many, many connections are opened and closed ... one for each process. My code looks something like this: PATH = "/tmp" class DB(object): def __init__(self): connected = False while not connected: try: cnxpool = mysql.connector.pooling

How would you test a Connection Pool

爱⌒轻易说出口 提交于 2019-11-27 21:00:22
问题 I have implemented a very simple ConnectionPool in Java. It has no fancy features, just get/release connection methods. How can I test it is working? I know there are plenty of connection Pools ready to use out there, which are much more reliable than what I'll do, but I am just trying to practice to understand how connections Pool work. Thank you! Here is the code in case it helps: public class ConnectionPoolImpl implements ConnectionPool { private Vector<PooledConnection> connections; //

How good is Oracle Universal Connection Pool (UCP)

╄→гoц情女王★ 提交于 2019-11-27 19:22:20
Does anybody have experience with using Oracle UCP under real production load? Does it handle database reconnects well? Are there any multi-threading issues? Has anybody compared it with C3P0 or Apache DBCP? MRalwasser I evaluated UCP 11.2.0.1 as a replacement for our legacy connection pool and I cannot recommend it : it does not fully support jdk 6 / ojdbc6.jar. For example the use of statement caching and jmx-support does not work with java 6 and throws exceptions. no internal statement cache - it relies on the jdbc driver's statement cache ( setPoolable() ) I submitted both issues to oracle

Optimal number of connections in connection pool

依然范特西╮ 提交于 2019-11-27 19:16:22
问题 Currently we are using 4 cpu windows box with 8gb RAM with MySQL 5.x installed on same box. We are using Weblogic application server for our application. We are targeting for 200 concurrent users for our application (Obviously not for same module/screen). So what is optimal number of connections should we configured in connection pool (min and max number) (We are using weblogic AS' connection pooling mechanism) ? 回答1: There is a very simple answer to this question: The number of connections