1

Hi I have a Synology NAS DS216j in my LAN and I am running a postgreSQL database on it.

I am try to find a way to connect and run my database from a computer outside my LAN so I can use it and update it. In order to do that I had to forward the port 5432 (postgres) and WebDav (5005) of my router to the NAS.

The port Postgresql (5432) and WebDav (5005 )is open on my public IP. The port Postgresql (5432) and WebDav (5005 )is open on the NAS.

From the remote host: I am able to see the database file (in LibreOffice Base), on the NAS if I connect with quickconnect or WebDav (in windows I installed the program: NetDrive).

I am able to connect to the database structure with PgAdminIII. but I am not able to Launch/Open the database. When I get prompt the user and password I just get this error saying:

The connection to the data source "NAS" could not be established. Couldnt establish database connection to ´sdbc:postgresql:postgresql://192.168.0.20:5432/dbname´ could not connect to the serve: Connection timed out (0x0000274c/10060). Is the server running on host 192.168.0.20 and accepting TCP/IP connection on port 5432?

I wonder why I am able to connect with PgAdminIII but not able to open the LibreOffice Base from WebDav.

----UPDATE ----

enter image description here

migrated from serverfault.com Aug 11 '17 at 1:18

This question came from our site for system and network administrators.

  • The error message suggests that you are using the (private) IP address 192.168.0.20, which will not work from outside your LAN. Try using your PUBLIC IP address when connecting from remote locations (ie outside your LAN). Also, I'd use a ':' in front of the port number (not a '/') eg when using the LibreOffice's Database Wizard, step 2 (connection settings) the datasource URL should probably look something like: postgresql://YOURPUBLICIPADDRESSHERE:5432/dbname . – stefan Aug 11 '17 at 7:48
  • Hi, I am using Netdrive with Webadav to connect from outside my LAN. I do use my PUBLIC IP to Connect to the NAS. I can see the LibreofficeFiles and I can open the Database file, but when I try to open a form of the database I get a request of user and password (which I know), but then i get the error above mentioned. And yes I used the ":", my mistake, will update my post now. – bostongeorge Aug 11 '17 at 15:17
  • It seems that you are using Netdrive to access the LibreOffice file sitting on your NAS box. Is this the case? Connection "diagram": Remote Machine (using NetDrive) <-> Router <-> Nas Box (Libre Office file located here). That would explain why PgAdmin works REMOTELY (using your public IP address), but Libre Office doesn't. NetDrive seems to be built for transferring files (ie it does not handle traffic to/from the Postgresql server adequately). – stefan Aug 12 '17 at 7:28
  • As a next step I suggest that you try the following: with the computer connected to your LAN (no need to leave the house :-), create a LibreOffice test file on the machine you intend to use REMOTELY. Use your OUTSIDE IP address. Then try to connect. Let us know what happens. Use the "Test" button when stepping through the "Wizard". If you get an error message "FATAL: no pg_hba.conf entry for host ...", then you are on the right track. – stefan Aug 12 '17 at 7:32
  • Get rid of the "FATAL ..." message (see previous comment) by adding an entry into pg_hba.conf, in the # IPv4 local connections section: host all all YOURPUBLICIPADDRESS/32 md5 Save the conf file, the restart the postgres server (service). Now the "Test Connection" should be successful. – stefan Aug 12 '17 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.