How do you create multiple DB connections using singleton patterns? Or maybe there is a better approach to sharing the same class, but many connections?
How to Use Factory Pattern To return the same example for each connection, for example < / P>
ConnectionFactory :: getInstance (ConnectionFactory :: development);
Gives an connection
example for connection to the development database.
The principle of connection
should be done only by ConnectionFactory
, which can reference those examples in a stable array, connection type. This is to avoid the singleton pattern, but it ensures that you have every connection
.
Comments
Post a Comment