|
Red Hat 9.0 上 python连postgreSQL,情况如下:
[liubing@risk tutorial]$ ps aux|grep postgre
postgres 2151 0.0 0.2 10964 524 ? S 19:21 0:00 /usr/bin/postmaster -p 5432
postgres 2153 0.0 0.0 11604 228 ? S 19:21 0:00 postgres: stats buffer process
postgres 2158 0.0 0.0 10656 252 ? S 19:21 0:00 postgres: stats collector process
liubing 7997 0.0 0.2 4812 636 pts/0 S 22:31 0:00 grep postgre
[liubing@risk tutorial]$ psql sa
sa=> \dt
关系列表
模式 | 名字 | 类型 | 所有者
--------+------+------+---------
public | test | 表 | liubing
(1 行)
sa=> \q
[liubing@risk tutorial]$ python
>>> import _pg
>>> db=_pg.connect('sa','localhost')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
_pg.error: could not connect to server: Connection refused
Is the server running on host localhost and accepting
TCP/IP connections on port 5432?
>>>
请教大虾,这是怎么回事?server显然是running,port显然是5432,难道是不接受TCP/IP连接?不会吧 |
|