[RHEL] How to define the number of Max Connections in PostgreSQL?

Solution Verified - Updated -

Environment

  • All Red Hat Enterprise Linux versions
  • All PostgreSQL version

Issue

  • You need to change the default number of Max Connections in PostgreSQL. How to change it?

Resolution

  • Use the parameter "source.setMaxConnections(number)" on your postgreSQL config file. Example:

    Jdbc3PoolingDataSource source = new Jdbc3PoolingDataSource();
    source.setDataSourceName("A Data Source");
    source.setServerName("localhost");
    source.setDatabaseName("test");
    source.setUser("testuser");
    source.setPassword("testpassword");
    source.setMaxConnections(10);
    
  • More details about this config can be found at PostgreSQL documentation: http://www.postgresql.org/docs/7.4/static/jdbc-datasource.html#JDBC-DS-EXAMPLE

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.