On 02/02/2017 02:22 AM, Suliman wrote:
> Am I right understand that if I use pool I can create connection
> instance one time in DB class constructor end every new connection
> will be created on demand?

No. You create the pool once (wherever/whenever you want to). Then, every time you want to use the database you obtain a connection by calling MySqlPool.lockConnection.


Ok, I read articles about pool, as I understood it's depend on of the
implementation. For example method `close` in pool mode should not close
connection, but return it to pool.


Calling 'close' will always close the connection. If you got you connection from the pool, then it will automatically return to the pool when you're no longer using it. No need to do anything special for that.

Could you tell about your implementation. Also actual question is can I
open connection in constructor (during class instance creation) ?

You can open a connection in a constructor if you wish. Or wherever you want to.

Reply via email to