简体   繁体   English

使用 java 的 Postgres 连接池

[英]Postgres connection pooling using java

I'm using multithreading concept in java and thread's responsibility is to connect to postgres and upload my csv's to tables.我在 java 中使用多线程概念,线程的职责是连接到 postgres 并将我的 csv 上传到表。 So far,I'm creating connection for each thread and closing upon finsihing thread's task.I was come across their is something called connection pooling.到目前为止,我正在为每个线程创建连接并在完成线程的任务时关闭。我遇到了它们称为连接池的东西。 I'm not aware, How do I integrate this connection pooling concept to my application?我不知道,如何将此连接池概念集成到我的应用程序中? I'm confused, where to start and how do I start?我很困惑,从哪里开始以及如何开始?

Thanks in Advance提前致谢

It would be helpfull if you provide some more context or code.如果您提供更多上下文或代码,将会有所帮助。

PostgersSql provides two Datasources one which provides pooling and other does not. PostgersSql 提供了两种数据源,一种提供池化,另一种不提供。 Please refer to this https://jdbc.postgresql.org/documentation/head/ds-ds.html请参考这个https://jdbc.postgresql.org/documentation/head/ds-ds.html

However if you are using any kind on application server it should have provided some Manager to maintain connection.但是,如果您在应用程序服务器上使用任何类型,它应该提供一些管理器来维护连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM