can't connect via jdbc
can't connect via jdbc
От:
Jonathan Sand <sand@gizmolab.com>
Дата:
If some kind soul could help straighten me out... :) I recently installed Red Hat Linux 5.2, along with postgresql 6.3.2 (rpm). The postmaster is running, started from the /etc/rc.d/init.d/postgresql script, which I changed so that the backend runs in verbose mode, produces debugging output and redirects output to a log file: su postgres -c '/usr/bin/postmaster -d 9 -p 2002 -D/var/lib/pgsql > /var/lib/pgsql/log/pg_log 2>&1 &' After running this script, the log file contains startup output. I can run the psql monitor and do normal SQL things on the redhat machine. What I can't seem to do is connect to postgres from another machine. I've written a java program which does a connect, using JDBC. This works fine connecting to postgresql 6.3.2 running on a Slakware Linux machine. I believe I've configured postgres to accept connections from my other machine, adding the following line to pg_hba.conf: host all 193.1.1.0 255.255.255.240 trust The redhat machine is 193.1.1.2 and the other machine is 193.1.1.4. These are local ip addresses, only valid on my side of an ISDN router. I've added the java program's user name to pg_user, and granted that user full access. I do a connect from the other machine; the log file shows no output relating to this attempted connection. Thinking it might be a port problem, I ran tcpdump. I'm not an expert in interpreting its output, but the ethernet traffic looks like a valid request was made from the other machine to the correct port and acknowledged by the redhat machine from the correct port. I can telnet as the java user from the other machine to the redhat machine and run psql, so my access is at least configured that far. Can anybody tell me what vital bits am I missing in my configuration? Thank you, Jonathan Sand sand@gizmolab.com Hardware: n. that aspect of a computer system which can be hit.
Re: [INTERFACES] can't connect via jdbc
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Jonathan Sand writes: > If some kind soul could help straighten me out... :) > su postgres -c '/usr/bin/postmaster -d 9 -p 2002 -D/var/lib/pgsql > > /var/lib/pgsql/log/pg_log 2>&1 &' You forgot the -i switch ... so the postmaster is not listening for TCP connections, only local Unix-socket connections. Note to postgres crew: I think we ought to think about changing the postmaster switches so that -i is default behavior, and you have to supply some other switch if you want to *turn off* TCP access. This Question is far too Frequently Asked... regards, tom lane