Skip to main content

Connection Pool: cannot connect to or ping postgresql server

Please note these forums are being decommissioned and use the new and improved forums at
2 replies [Last post]
Joined: 2012-08-07


I have created a connection pool, but when pressing the Ping button in the Glassfish administration console I get the following error:

WARNING: RAR8054: Exception while creating an unpooled [test] connection for pool [ connectionPool ],
Connection could not be allocated because: Connection refused.
Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

SEVERE: RestResponse.getResponse() gives FAILURE.
endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json';
attrs = '{id=connectionPool}'

The database works fine. Using psql command line tool or a Netbeans Database Connection I can connect without any problems.

When I try to deploy the application from Netbeans, I get a similar error, so I guess it's a problem with the connection pool.

Some additional information about connection pool settings:

Resource Type: javax.sql.DataSource
Datasource Classname: org.postgresql.ds.PGSimpleDataSource

Password: ***
User: ***
URL: jdbc:postgresql://db_server:5432/db_name

My Glassfish version is glassfish-, I use it from Netbeans 7.2 on Ubuntu 12.04.

I tried already to increase the logging level, but I didn't get much more information. Maybe I enabled the wrong loggers, there are so many.

Under JVM settings I also enabled debug mode, but I don't really know how to use it.

Before, I used ngrep to watch my traffic on port 5432, when pinging, but I couldn't see any traffic.

Furthermore, I copied the driver jars to

Could someone with more experience then I have assist me in debugging my connection issue?
Thanks in advance,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-03-28

Could you try using the URL format like : "jdbc:postgresql://DB_HOSTNAME/DATABASE_NAME:5432" ?

Joined: 2012-08-07


I just got it working!
I restarted from scratch using this guide:
but used
Resource Type: javax.sql.DataSource
Datasource Classname: org.postgresql.ds.PGSimpleDataSource

I also think that I used a wrong driver version...

The lesson learned: sometimes it may be easier to restart then debugging for hours.

Thank you.