Link to home
Start Free TrialLog in
Avatar of smriti priyanka
smriti priyanka

asked on

ould not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

how to resolve it.

Please suggest.

Thanks.
Avatar of David Favor
David Favor
Flag of United States of America image

This will show all listeners for the above port...

sudo netstat -pluten | egrep :5432

sudo nmap -sV -Pn -p 5432

Open in new window


There must be a listener running on port 5432 for you to make a connection to this port.

Post the output of the commands above.
Avatar of smriti priyanka
smriti priyanka

ASKER

I am using Apache Tomcat version 9
Using windows Operating System and trying to run one dynamic web project trying to connect postgresql server and using Eclipse as IDE.

But getting above mentioned exception.
Driver not found.

I also wanted to ask when I am running a program as java application the I am getting connected.
but when I am trying to run as web project with Apache tomcat as a server I am unable to get the database connection.

Please suggest what may be the issue.

I am attaching the screenshot for which process is running at particular port.



You'll first arrange for Apache + Tomcat to start + serve content.

After this is working, you can follow whatever guide you're using to somehow integrate Apache/Tomcat in to Eclipse.
@ yes Apache tomcat with eclipse working fine but I am not able to connect to database.
Database != Apache/Tomcat

You'll debug this using psql to test your connection, verifying you have a working host/port/user/pass.

Then simply transpose the working host/port/user/pass into your code.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.