Do the connection pools work according to the programming language or the web/application server?

Viewed 36

First of all I'm a newbie, so I hope you have patience with my existential crisis

I'm a bit confused... connection pools are only for application servers (Tomcat) and not web servers (Apache) ?

It only works in some languages?

I tried to do SQL transactions from PHP and failed.I know that it is possible to make transactions, but not to make them at the moment the user clicks the commit or rollback button to save points . That's why I wanted to use a connection pool, but I can't XD

I read that it is not possible in PHP, but if in JAVA , then I wonder the connection pool is configured in the language or in the server?

1 Answers

Connection Pool is a term which represents a cache of reusable connections. It is not necessarily implying an application server, it can be a webserver as well. It is definitely possible in PHP:

enter image description here

http://php.adamharvey.name/manual/en/mysqlnd-ms.pooling.php

You can create a connection in a PHP script and you will be able to reuse it without recreating it.

It is very important to separate the concept of a server from the concept of a language. A language is defined by its syntax and its concepts. Yet, abstract terms, such as the connection pool exist wherever the server supports it. One can write a PHP server that supports connection pooling and another which does not.

You can read about connection pooling on nginx, a well-known server that supports PHP:

https://www.nginx.com/blog/load-balancing-with-nginx-plus-part-2/

Further reading: https://www.php.net/manual/en/pdo.connections.php

Related