connection-pooling

How to clear the ODP.NET connection pool on connection errors?

不想你离开。 提交于 2019-11-29 11:52:31
问题 I'm using NHibernate and ODP.NET to connect to a Oracle 11g database. Of course there can be connection errors (network failure, DB down, ...). I'm handling all these exceptions in my code, so no problem there. But of course the user can retry his actions (maybe it was just a short network failure), and there comes my problem: ODP.NET is using connection pooling by default. No problem with that usually, but when the user retries an action after a connection error, NHibernate gets an invalid

Using connection pool with JSCH

老子叫甜甜 提交于 2019-11-29 10:42:49
I'm using JSCH for file upload ever sftp. In it's current state each thread opens and closes connection when needed. If it possible to use connection pooling with JSCH in order to avoid overhead caused by large number of connection opening and closing? Here is a example of function called from inside of thread public static void file_upload(String filename) throws IOException { JSch jsch = new JSch(); Session session = null; try { session = jsch.getSession("user", "server_name", 22); session.setConfig("StrictHostKeyChecking", "no"); session.setPassword("super_secre_password"); session.connect(

What's the proper way to handle JDBC connections with Spring and DBCP?

坚强是说给别人听的谎言 提交于 2019-11-29 10:28:20
I'm using the Spring MVC to build a thin layer on top of a SQL Server database. When I began testing, it seems that it doesn't handle stress very well :). I'm using Apache Commons DBCP to handle connection pooling and the data source. When I first attempted ~10-15 simultaneous connections, it used to hang and I'd have to restart the server (for dev I'm using Tomcat, but I'm gonna have to deploy on Weblogic eventually). These are my Spring bean definitions: <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com

.NET, the SqlConnection object, and multi-threading

岁酱吖の 提交于 2019-11-29 09:36:18
We have an application which uses an SQL Server 2008 R2 database. Within the application, calls to the database are made using a SqlConnection object. This SqlConnection object is initialized once, the first time it is accessed, and then re-used throughout the application. The action that we use is the following: Protected _cn As SqlConnection = Nothing ... Protected Sub Open() If _cn Is Nothing Then _cn = New SqlConnection(_sqlConn) End If If _cn.State = ConnectionState.Closed OrElse _cn.State = ConnectionState.Broken Then _cn.Open() End If End Sub This works perfectly fine during normal

Creating a database connection pool

孤人 提交于 2019-11-29 09:33:03
问题 Need information on creating a connection pool to the database (irrespective of the database) , and how efficient they are? What are the conditions where they can enhance performance. How to create it explicitly? 回答1: Your question is a bit ambiguous: Do you want to homegrow a connection pool implementation? If so, this is a nice starting point: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/conpool.html But this is highly discouraged for production environments. Better use

hibernate default connection pooling

时光怂恿深爱的人放手 提交于 2019-11-29 09:14:14
Does Hibernate use connection pool by default? If so what is the default value for *connection.pool_size*? Doesn't it conflicts with *hibernate.connection.release_mode*? Isn't the all idea of connection pooling is not closing connections? The default hibernate connection pool (which shouldn't be used in production) has a default limit of 1, since it is meant to just be used for simple testing. However this is configurable through the hibernate.properties file, so it's worth checking to see if it's defined there in your project. The property in question is: hibernate.connection.pool_size

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

柔情痞子 提交于 2019-11-29 08:47:40
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-configuration> <session-factory> <property name="connection.datasource">java:comp/env/jdbc/hposg</property>

Hibernate/MySQL Connection Timeout

可紊 提交于 2019-11-29 07:32:59
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 because it didn't have any effect when I applied it, I decided to go for c3p0 . Unfortunately, after

How do I create a MySQL connection pool while working with NodeJS and Express?

送分小仙女□ 提交于 2019-11-29 07:30:54
问题 I am able to create a MySQL connection like this: var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', user : 'me', password : 'secret', database : 'my_db' }); connection.connect(); But I would rather like to initiate a pool and use it across my project. 回答1: Just to help some one in future, this worked for me: I created a mysql connector file containing the pool: // Load module var mysql = require('mysql'); // Initialize pool var pool = mysql.createPool

HttpClientError: The target server failed to respond

孤人 提交于 2019-11-29 07:12:29
问题 I am trying to hit a server using http client using PoolingClientConnectionManager setting max connections for individual hosts //Code that inilizes my connection mananger and http client HttpParams httpParam = httpclient.getParams(); HttpConnectionParams.setSoTimeout(httpParam, SOCKET_TIMEOUT); HttpConnectionParams.setConnectionTimeout(httpParam, CONN_TIMEOUT); httpclient.setParams(httpParam); //Run a thread which closes Expired connections new ConnectionManager(connManager).start(); //Code