You can create a class (or class namespace depending on size) to host the database level. In your database class, you should simply use the connection pool at the database level. The pool will support n number of connections open in the database at any given time, so you can simply run a query using one of the combined connections without incurring significant overhead.
In doing so, your database tier should be an βAPIβ of public methods that the business tier can invoke. None of these methods should show the database connection object β this data is internal to the data layer.
Then, from your business layer, just go to the βAPIβ database layer every time you need to complete a query.
Does it help?
source share