connection-pooling

How to force a SqlConnection to physically close, while using connection pooling?

人盡茶涼 提交于 2019-11-26 15:58:08
问题 I understand that if I instantiate a SqlConnection object, I am really grabbing a connection from a connection pool. When I call Open(), it will open the connection. If I call the Close() or Dispose() method on that SqlConnection object, it is returned to the connection pool. However, that doesn't really tell me if it's really closed, or if I still have an active connection to the database. How can I force a SqlConnection to close at the network level, or at least tell when it closes? Example

Am I Using JDBC Connection Pooling?

ⅰ亾dé卋堺 提交于 2019-11-26 15:50:34
I am trying to determine if I am actually using JDBC connection pooling. After doing some research, the implementation almost seems too easy. Easier than a regular connection in fact so i'd like to verify. Here is my connection class: public class DatabaseConnection { Connection conn = null; public Connection getConnection() { BasicDataSource bds = new BasicDataSource(); bds.setDriverClassName("com.mysql.jdbc.Driver"); bds.setUrl("jdbc:mysql://localhost:3306/data"); bds.setUsername("USERNAME"); bds.setPassword("PASSWORD"); try{ System.out.println("Attempting Database Connection"); conn = bds

Correct way to keep pooled connections alive (or time them out and get fresh ones) during longer inactivity for MySQL, Grails 2 app

本秂侑毒 提交于 2019-11-26 15:39:36
问题 I have a grails app that has flurries of high activity, but then often periods of inactivity that can last several hours to over night. I notice that the first users in the morning get the following type of exception, and I believe this is due to the connections in the pool going stale and MYSql database closing them. I've found conflicting information in Googling about whether using Connector/J connection property 'autoReconnect=true' is a good idea (and whether or not the client will still

Android BLE Connection time interval

老子叫甜甜 提交于 2019-11-26 13:03:02
问题 I am developing a BLE application on Nexus 4 using Android BLE API. I have a few questions/doubts: 1) Is there a way to set/override the connection or notification interval of BLE central device. I have found that for Android, the default connection interval is fixed to 7.5ms. Is there a way to change this connection/notification delay interval settings. Source : http://processors.wiki.ti.com/index.php/Bluetooth_SensorTag?DCMP=lprf-stdroid&HQS=lprf-stdroid-pr-wiki1#Supported_Android_devices 2

Is there any way to have the JBoss connection pool reconnect to Oracle when connections go bad?

北城余情 提交于 2019-11-26 13:02:28
问题 We have our JBoss and Oracle on separate servers. The connections seem to be dropped and is causing issues with JBoss. How can I have the JBoss reconnect to Oracle if the connection is bad while we figure out why the connections are being dropped in the first place? 回答1: There is usually a configuration option on the pool to enable a validation query to be executed on borrow. If the validation query executes successfully, the pool will return that connection. If the query does not execute

What is the best solution for database connection pooling in python?

匆匆过客 提交于 2019-11-26 12:22:02
问题 I have developed some custom DAO-like classes to meet some very specialized requirements for my project that is a server-side process that does not run inside any kind of framework. The solution works great except that every time a new request is made, I open a new connection via MySQLdb.connect. What is the best \"drop in\" solution to switch this over to using connection pooling in python? I am imagining something like the commons DBCP solution for Java. The process is long running and has

Closing JDBC Connections in Pool

眉间皱痕 提交于 2019-11-26 11:31:47
Our standard code section for using JDBC is... Connection conn = getConnection(...); Statement stmt = conn.conn.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rset = stmt.executeQuery (sqlQuery); // do stuff with rset rset.close(); stmt.close(); conn.close(); Question 1: When using Connection Pool, should one close the Connection at the end? If so, isn't the purpose of pooling lost? And if not, how does the DataSource know when a particular instance of Connection is freed up and can be reused? I am a little confused on this one, any pointers

Why doesn't Dapper dot net open and close the connection itself?

别说谁变了你拦得住时间么 提交于 2019-11-26 11:21:03
问题 Dapper implicitly expects a connection to be open when it uses it. Why doesn\'t it open and close it itself? Wouldn\'t this simply connection management? I ask because a co-worker and I have been going back and forth on the nature of what goes on behind the scenes with connection pooling, and if there is any benefit to keeping a connection open amongst multiple commands, or to open and close it for each command. 回答1: Dapper now (and for quite some time) deals with this internally. It just

JDBC MySql connection pooling practices to avoid exhausted connection pool

做~自己de王妃 提交于 2019-11-26 08:03:34
I have a Java-JSF Web Application on GlassFish, in which I want to use connection pooling. Therefore I created an application scoped bean that serves with Connection instances for other beans: public class DatabaseBean { private DataSource myDataSource; public DatabaseBean() { try { Context ctx = new InitialContext(); ecwinsDataSource = (DataSource) ctx.lookup("jdbc/myDataSource"); } catch (NamingException ex) { ex.printStackTrace(); } } public Connection getConnection() throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException { Connection connection =

Java JDBC connection pool library choice in 2011/2012?

落爺英雄遲暮 提交于 2019-11-26 07:56:00
问题 Which JDBC connection pool library should I use for a new application project (not web application)? Apache DBCP has enough unresolved issues which are pushed until 2.0 I think. C3P0 development seems to be stopped. And both of them looks relatively slow. Proxool is dead. DBPool has almost no community (at least I\'ve found no public one - no forums, no mailing lists...) Apache Tomcat Pool looks to be unusable without Tomcat I\'ve found SQL Datasources article at Oracle website, but it seems,