Java – should I use connection pooling?

I am writing an ETL project in Java I will connect to the source database, get the data only once, make some transformations, and load the data into the target database

The key is that I don't repeatedly connect to the source database or target database I only connect once (using JDBC), get the data I need and close the connection

Should I still use connection pooling?

Thank you for your advice!

Solution

Connection pooling is used to address the fact that many database drivers take a long time to create connections If you only need to use it quickly and then discard it, if you need a lot of connections, it may be expensive (including time and CPU) Reuse is faster than creating new ones

If you do not have this need, if you do not have a connection pool, there is no reason to set up a connection pool If you happen to have one, use it

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>