PostgreSQL via pgAdmin III - Server Doesn't Listen

1k Views Asked by At

Our company has an old linux server that runs a few tomcat web applications. One of those applications is connecting to PostgreSQL. While I'm a C#.Net/Windows coder, I need to connect to this database from my computer using pGAdmin III (or any suggested equivalent). When attempting the connection, pgAdmin says Server Not Listening.

Without knowing much about linux I'm using WinSCP to connect to the file structure. I have ZERO documentation on the old apps, any data sources, or their data connections. I've been able to determine the following, assuming the location of the web app is actuallly legit and not some non-running copy.

PostgreSQL

In one app's connection information:

 jdbc:postgresql://localhost:5432/somename

After some digging, I found the following possible instances of postgresql on the server file structure.

\etc\postgresql\8.3\main
\etc\postgresql\8.4\main

There's also \etc\postgresql-common with very different types of files in there.

If there are other instances or related folder, I am unaware and wouldn't know where to look. It's a labyrinthine beast.

I ensured in the config file for both that listening="*", which was supposed to be one of two fixes. It was already set to *, so assuming one of these is the right one, I should be good there.

I know that at least some instance of postgresql is turned on because the old app is running and fetching data, so that's the other of the two fixes.

pgAdmin

I heard in a separate thread here that reinstalling pgAdmin might solve the problem, but it did not. I tried with and without ssl.

Here is how I'm trying to set up the connection in pgAdmin III:

Name: SomeName

Host: I've tried a few combinations here. //servername/somename, or just //servername

Port: 5432 (matches what was expected, also the port from the connection)

Service: Blank

MaintenanceDB: I tried the default in pgadmin, postgres and the actual db I'm trying to connect to.

username & Password: the credentials from the connection info in the old app.

I'm getting the Server Doesn't Listen, suggesting that either it's not on (Well...some data source is on and working and the data in WEB-INF suggests it's postgresql), or it's not accepting TCP/IP connections, which it is according to the instances of postgresql I was able to find.

Long Story Short

At this point I'm assuming that one of the following is the problem...

  1. The connection information I'm entering into postgreSQL is not being entered correctly, but I don't know what I'm doing wrong.

  2. The source of the connection information (the web application) is bad/old/not from a running instance (and in this case I don't know how to tell, not in linux).

  3. The instances of postgresql I found are not the instances it's using, and I have no idea how to find it.

  4. Something's fishy network-wise, but since both my computer and the linux server are on the same network, it doesn't seem too likely.

Also, everyone, please document your stuff for the poor souls of the future. I greatly appreciate any assistance you are able to offer me.

1

There are 1 best solutions below

1
On

You may want to use a tunnel:

ssh -L 5432:localhost:5432 user@server

After you log into the remote server, you'll have mapped port 5432 on your computer to the remote one. Then you can use pgAdmin to connect to your localhost on port 5432. Make sure you don't have anything running on this port on your computer.

Edit: Look at these examples on how to setup tunnels using putty