Java Connection Pool

I searched the connection pool and read about it. If I understand it correctly, the connection pool is similar to building open connections. If a connection is established or created, it must be added to the connection pool, and if this connection is closed, it should be deleted in the connection pool; while it is open, I can use it again and again.

When reading these guides and explanations about the connection pool, I have a few questions:

  • Can I use the connection pool only on a specific computer? How can ComputerA not share its connection pool with ComputerB?

  • Where should be located connection.close()?

Is it correct to use the connection only when selecting / loading a record? After I received the returned records / data, I close the connection to finally. Same as adding, editing and deleting entries. And while it is being processed, I place a progress bar, so the user will need to wait for it to complete and again execute some process, which means that I will only open the connection one at a time.

Thanks for the explanation.:)

+5
source share
1 answer

Note. I assume we are talking about an java.sql.Connectioninterface.

Can I use the connection pool only on a specific computer? How can ComputerA not share its connection pool with ComputerB?

. , , .

connection.close()?

close() Connection ( finally). , . : JDBC

/ ? , /, finally.

, . Connection - SQL/DML, , close() finally, .

+8

All Articles