python连接postgresql问题,帮我看看.

python连接postgresql问题,帮我看看.

from pyPgSQL import PgSQL
PgSQL.connect(host='jianguo',user='postgres',password='lzs643770',database='ShowRoom')

Traceback (most recent call last):
  File "<pyshell#14>", line 1, in -toplevel-
    PgSQL.connect(host='jianguo',user='postgres',password='lzs643770',database='ShowRoom',port='5432')
  File "C:\Python24\Lib\site-packages\pyPgSQL\PgSQL.py", line 2355, in connect
    return Connection(connInfo, client_encoding, unicode_results)
  File "C:\Python24\Lib\site-packages\pyPgSQL\PgSQL.py", line 2510, in __init__
    raise DatabaseError, m
DatabaseError: could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "jianguo" and accepting
        TCP/IP connections on port 5432?

应该是连接上的,为什么说不行呢.


[Copy to clipboard] [ - ]
CODE:
DatabaseError: could not connect to server: Connection refused (0x0000274D/10061)
         Is the server running on host "jianguo" and accepting
         TCP/IP connections on port 5432?

client_encoding, unicode_results:你的pgsql的locale设置的是什么???

DatabaseError: could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "jianguo" and accepting
        TCP/IP connections on port 5432?
你在命令行下手动敲入这些相应的数据是否能够登录成功???
你的postgresql没有打开允许tcp访问的选项