cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

postgresql server connection using Node-red to query

mohamedhamdad
Occasional Visitor

postgresql server connection using Node-red to query

Hello everybody,

I want to connect my postgresql server with ctrlx. The Idea is to use Node-red with the help of node-red-contrib-re-postgres to query my database. However when trying to connect to the database hosted on windows i get the following error:

Error: connect ECONNREFUSED 127.0.0.1:5432

Did anybody try connecting to a database from the virtual ctrlX using Node-red? If thats the case I would be realy happy if somebody can help me out.

 

kind regards

Tags (1)
8 REPLIES 8
CodeShepherd
Community Moderator

Re: postgresql server connection using Node-red to query

It looks like you are using the control in port forwarding mode. Did you enter the needed port 5432 to forwarding list?

CodeShepherd_0-1643795531598.png

 

Re: postgresql server connection using Node-red to query

Hi,

thank you for your reply. When setup port forwarding, the ctrlX does not boot and remains offline. The error message I get is the one attached.

CodeShepherd
Community Moderator

Re: postgresql server connection using Node-red to query

The error simply means that port 8443 is already in use on your PC by another process. Please check that only one ctrlX COREvirtual in port forwarding is running with standard settings.

A bigger screenshot of the whole page is always better because of more information are available.

Re: postgresql server connection using Node-red to query

I have choosen the right port 8444:5432 (where 5432 is used by by Postgres). I am setting in my Postgres node that it should use localhost and the port 5432, however I still get the same error. I've tried running node-Red and is working with my DB (reading and writing), however when running Node-Red on virtual ctrlX it keeps complaining.

 

CodeShepherd
Community Moderator

Re: postgresql server connection using Node-red to query

For e.g. 8022:22
The right port is the internal port of the ctrlX COREvirtual and the left port is the one where it is mapped to on your host operating system.

So in your case it should be 5432:5432 because your DB is expecting it on the host OS (left) and then inside of your ctrlX COREvirtual the same port number is used by your client (right).

Re: postgresql server connection using Node-red to query

Hi,
yes, that was my initial thought. However, when I do that, the virtual ctrlX refuses to boot.
It says that it could not set up the port forwarding rule 5432:5432.

FooFighter
Established Member

Re: postgresql server connection using Node-red to query

Hello,

from the virtual control inside qemu the windows host pc always has the ip 10.0.2.2

If your db listens on your local windows on port 5432, then you should have access from the virtual control on 10.0.2.2:5432

Regards,
Oliver

Re: postgresql server connection using Node-red to query

Hello Oliver,
thank you for your reply. Your solution worked 😀  !!
kind regards,
Mohamed

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist