教えてください。psycopg2を使うとエラーが返ります。
ソースコードは

# -*- coding: utf-8 -*- 

import psycopg2

if __name__ == "__main__":

    connector = psycopg2.connect(host="127.0.0.1",database="pdb",user="pgusr",port=5432, password="pgpsw")
    cursor    = connector.cursor()

    sql = "insert into test_table values('1','python')"
    cursor.execute(sql)
    sql = "insert into test_table values('2','パイソン')"
    cursor.execute(sql)
    sql = "insert into test_table values('3','ぱいそん')"
    cursor.execute(sql)

    connector.commit()

    cursor.close()
    connector.close()

で、環境はwindows上のpython2.7.11です。

原因は何なのでしょうか?ダライバーだけをinstallしてもだめですか?
エラー内容は

Traceback (most recent call last): File "test105.py", line 7, in

connector = psycopg2.connect(host="127.0.0.1",database="pdb",user="pgusr",port=5432,
password="pgpsw") File
"C:\Python27\lib\site-packages\psycopg2__init__.py", line 164, in
connect
conn = _connect(dsn, connection_factory=connection_factory, async=async) psycopg2.OperationalError: could not connect to server:
Connection refused (0x0000274D/10061)
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?