Spring JDBC connection pool best practices

C3PO and DBCP development have stalled mostly because they are mature. I have seen both of these drivers be able to support hundreds of transactions per second. The Tomcat pool is a reworked & updated DBCP driver. MyBatis 3.0 also contains it’s own pooling implementation which, based on code inspection, seems solid. Finally, there’s BoneCP … Read more

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

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 1 and Question 2 I always use SET … Read more

Hibernate: What is the connection pool and why is the default one unsuitable for production?

What is the connection pool and why is the default one unsuitable for production? Can someone elaborate on this? Connection pooling is a technique to open/prepare/close connections. A connection pooling mechanism is a piece of software (component), to which you delegate the function of managing connections. Your application would just ask for a connection, use … Read more

What does sp_reset_connection do?

Data access API’s layers like ODBC, OLE-DB and SqlClient call the (internal) stored procedure sp_reset_connection when re-using a connection from a connection pool. It does this to reset the state of the connection before it gets re-used. There does not appear to be official documentation on what things get reset, but here is an unofficial … Read more

.NET best practices for MongoDB connections?

Most answers here are outdated and are no longer applicable as the .net driver has matured and had numberless features added. Looking at the documentation of the new 2.0 driver found here: http://mongodb.github.io/mongo-csharp-driver/2.0/reference/driver/connecting/ The .net driver is now thread safe and handles connection pooling. According to documentation It is recommended to store a MongoClient instance … Read more

Should I set max pool size in database connection string? What happens if I don’t?

Currently your application support 100 connections in pool. Here is what conn string will look like if you want to increase it to 200: public static string srConnectionString = “server=localhost;database=mydb;uid=sa;pwd=mypw;Max Pool Size=200;”; You can investigate how many connections with database your application use, by executing sp_who procedure in your database. In most cases default connection … Read more

Connection pooling in PHP

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 … Read more