connection-pooling

What happens to an uncommitted transaction when the connection is closed?

旧巷老猫 提交于 2019-11-26 07:40:45
问题 Are they rolled back immediately? Are they rolled back after some period of time? Are they left in an uncommitted state? Is the behavior the same if connection pooling is used and the connections are simply reset? 回答1: It can stay open while connection pooling applies. Example: command timeout can leave locks and TXN because the client sends as "abort". 2 solutions: Test in the client, literally: IF @@TRANCOUNT <> 0 ROLLBACK TRAN Use SET XACT_ABORT ON to ensured a TXN is cleaned up: Question

Where do I have to place the JDBC driver for Tomcat&#39;s connection pool?

大兔子大兔子 提交于 2019-11-26 07:31:34
问题 So I\'ve figured out my error, now I\'m just looking for some insight as to what is going on exactly. I am using Apache Tomcat Version 7.0.32. I am using this tutorial to set up pooling for JDBC. In my META-INF folder I made a context.xml file and put this in there. <?xml version=\"1.0\" encoding=\"UTF-8\"?> <Context> <Resource type=\"javax.sql.DataSource\" name=\"jdbc/gmustudent\" factory=\"org.apache.tomcat.jdbc.pool.DataSourceFactory\" driverClassName=\"com.mysql.jdbc.Driver\" url=\"jdbc

Efficient SQL test query or validation query that will work across all (or most) databases

我们两清 提交于 2019-11-26 06:11:13
问题 Many database connection pooling libraries provide the ability to test their SQL connections for idleness. For example, the JDBC pooling library c3p0 has a property called preferredTestQuery, which gets executed on the connection at configured intervals. Similarly, Apache Commons DBCP has validationQuery. Many example queries I\'ve seen are for MySQL and recommend using SELECT 1; as the value for the test query. However, this query doesn\'t work on some databases (e.g. HSQLDB, for which

“There is already an open DataReader…” Reuse or Dispose DB Connections?

十年热恋 提交于 2019-11-26 05:31:08
Please Help.... When I select data from Mysql table its showing "There is already an open DataReader associated with this Connection which must be closed first. vb.net" Private Sub cmbJobCategoryVisa_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbJobCategoryVisa.SelectedIndexChanged ''" Dim MyCommand As New MySqlCommand("SELECT jobcategorycode FROM jobcategory WHERE jobcategory='" & Me.cmbJobCategoryVisa.SelectedItem & "'", MyConnection) Dim MyReader As MySqlDataReader = MyCommand.ExecuteReader While MyReader.Read If MyReader.HasRows = True Then Me

Am I Using JDBC Connection Pooling?

旧街凉风 提交于 2019-11-26 04:38:15
问题 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(\

Closing JDBC Connections in Pool

十年热恋 提交于 2019-11-26 02:27:34
问题 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

“There is already an open DataReader…” Reuse or Dispose DB Connections?

半腔热情 提交于 2019-11-26 01:55:01
问题 Please Help.... When I select data from Mysql table its showing \"There is already an open DataReader associated with this Connection which must be closed first. vb.net\" Private Sub cmbJobCategoryVisa_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbJobCategoryVisa.SelectedIndexChanged \'\'\" Dim MyCommand As New MySqlCommand(\"SELECT jobcategorycode FROM jobcategory WHERE jobcategory=\'\" & Me.cmbJobCategoryVisa.SelectedItem & \"\'\", MyConnection)

Connection pooling in PHP

放肆的年华 提交于 2019-11-26 01:47:24
问题 Is it possible to cache database connections when using PHP like you would in a J2EE container? If so, how? 回答1: There is no connection pooling in php. mysql_pconnect and connection pooling are two different things. There are many problems connected with mysql_pconnect and first you should read the manual and carefully use it, but this is not connection pooling. Connection pooling is a technique where the application server manages the connections. When the application needs a connection it

Connection pooling options with JDBC: DBCP vs C3P0

 ̄綄美尐妖づ 提交于 2019-11-25 22:45:30
问题 What is the best connection pooling library available for Java/JDBC? I\'m considering the 2 main candidates (free / open-source): Apache DBCP - http://commons.apache.org/dbcp/ C3P0 - http://sourceforge.net/projects/c3p0 I\'ve read a lot about them in blogs and other forums but could not reach a decision. Are there any relevant alternatives to these two? 回答1: DBCP is out of date and not production grade. Some time back we conducted an in-house analysis of the two, creating a test fixture which

How do I manage MongoDB connections in a Node.js web application?

佐手、 提交于 2019-11-25 22:36:29
问题 I\'m using the node-mongodb-native driver with MongoDB to write a website. I have some questions about how to manage connections: Is it enough using only one MongoDB connection for all requests? Are there any performance issues? If not, can I setup a global connection to use in the whole application? If not, is it good if I open a new connection when request arrives, and close it when handled the request? Is it expensive to open and close a connection? Should I use a global connection pool? I