1

My database is intalled on server behind a rooter that has a dynamic IP, i use a kind of DynDns to update DNS-DB-Server with the last Public IP of the server

in Glassfish connection pool properties i have entred as server name the DNS-DB-Server and in the URL jdbc:postgresql://DNS-DB-Server:5432...

all works fine till the public IP changes ofcourse my DNS-DB-Server points to the new Public IP but my web-application that uses the connection-pool can't reach the Database

is there some think else to configure in Glassfish to refresh the connection-pool.

alveomaster
  • 1,681
  • 2
  • 12
  • 21

1 Answers1

0

I'm not sure if the IP would be refreshed, but you certainly need to refresh the open connections. Configure connection validation on your connection pool, and in this case you probably want to set that all connections are refreshed when a validation fails. More info e.g. here (in the Connection validation section)

OndroMih
  • 7,280
  • 1
  • 26
  • 44
  • Thx that is great i try it, simply i wonder about latency, let me say once the public ip is updated the pooling process will still validate connection on every connection request or it regain the intial behavior and will configure a pool of connection in advance using that IP, in any case via tests i see that glassfish takes all the to refresh poll settings is this expected? – alveomaster Jan 14 '17 at 11:02
  • With validation on, every connection is validated before it is used by the application. If you turn on refreshing all connections when failure, once a validation on any connection fails (the IP is updated), all connections are dropped and recreated with the new IP. – OndroMih Jan 15 '17 at 00:08