webtier@glassfish.java.net

Re: Connecting to a remote postgres database in GF 3.1.1

From: Phillip Ross <phillip.w.g.ross_at_gmail.com>
Date: Sun, 22 Jan 2012 00:20:20 -0500

There shouldnt be anything you'd have to configure with server.policy.
 There's no security manager tricks or anything, I've used glassfish
v2 and v3s against postgres 8.0.x through 9.1.x and they all work well
on sol10x86. The most common problem I've seen with switching from a
local to remote DB is the actual postgresql configs. Make sure
postgresql.conf is configured to listen on external network interfaces
(not just 127.0.0.1/localhost) and make sure pg_hba.conf is configured
to permit connections on the non loopback networks.

When you say you can setup the connection pool and ping the remote
database, do you mean you can use the asadmin ping-connection-pool
with a successful report? or just an icmp ping against the IP address
of the remote host the postgres installation is running on?

Maybe providing some errors would help in troubleshooting?


On Sun, Jan 22, 2012 at 12:02 AM, <forums_at_java.net> wrote:
> I have run into a problem trying to connect to a postgres (8.2) data base
> that is on a remote server.  I am using Glassfish 3.1.1 and have also found
> the problem with Glassfish 2.1.1.  I can setup the connection pool and ping
> the remote database, I can access the remote database from pgAdmin which is
> on the same server that GF 3.1.1 and 2.1.1 are running and I can access the
> remote database from Netbeans on the same server the GF is running.  The
> code works with App Server 8.2 and Glassfish 2.1.1 but the database has
> alway
> been local to the Application Server.  Both the database server and the
> Glassfish server are Solaris 10 x86.  I looked at the server.policy file for
> both Glassfish 3.1.1 and 2.1.1 and they appear to allow connections.  The
> application is using EJB 2.1 technology but that does not appear to be a
> problem as the connection problem occurs in a servlet or in an Enitity Bean
> that is accessed through a servlet and a Session Bean.  Like I said this has
> worked for years with the database local to the App Server.  What don't I
> know or have forgotten about connecting to a remote database from a Java
> Application Server?
>
>
> --
>
> [Message sent by forum member 'salepointdata']
>
> View Post: http://forums.java.net/node/882897
>
>