[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Connecting to PostgreSQL without TCP/IP
From: |
Jason Cater |
Subject: |
Connecting to PostgreSQL without TCP/IP |
Date: |
Wed, 15 Jan 2003 11:46:59 -0600 |
User-agent: |
KMail/1.5 |
Greetings,
I recently ran across this tiny piece of trivia about PostgreSQL clients. If
you specify the "host" parameter to be a directory, then the client looks for
a sockets file in that directory.
In the past, we have told people that in order to use PostgreSQL with GNUe,
you would have to enable postmaster to listen for TCP/IP requests. This is
not true.
To get GNUe tools to use the sockets file (which is what psql uses if you do
not pass a -h value), your connections.conf file will look like:
[gnue]
comment = GNUe Test
provider = pypgsql
host = /tmp
dbname = gnue
note that most installations default to PostgreSQL's sockets file being in
/tmp. Debian is the exception. For a default Debian install, your file
would look like:
[gnue]
comment = GNUe Test
provider = pypgsql
host = /var/run/postgresql
dbname = gnue
Note that this is true of all psql clients. I actually discovered this when
trying to set up a Zope installation at work. To see this in action, try:
psql -h /var/run/postgres
This should behave the same as a plain "psql" without any options.
I do not know what "host=" line would be used for PostgreSQL running under Mac
OS 8/9 or Windows.
If you are running a single-machine setup (for example, a development
machine), you are more than likely better off using this setup than TCP/IP as
it is more secure (you can turn off TCP/IP listening so you aren't exposing
your database to anything but a local client) and supposedly faster.
-- Jason
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Connecting to PostgreSQL without TCP/IP,
Jason Cater <=