How to resolve FATAL: connection limit exceeded for non-superusers

前端 未结 2 754
自闭症患者
自闭症患者 2021-02-13 18:52

I have written a java code for bulk insertion. I\'m using the copy command for importing and creating different connection objects for different tables, but while executing, the

2条回答
  •  时光取名叫无心
    2021-02-13 19:33

    Are you using a connection pool? Check if connections are closed properly in your code. This should be done in a try-finally block:

    Connection connection = dataSource.getConnection();
    try {
        ....
    }
    finally {
        connection.close();
    }
    

    If you really need a large amount of connections, set the max_connections-property in postres accordingly.

    Documentation

提交回复
热议问题