こんにちは、私も python と firebird の初心者です。私の問題は、自分の python プログラムを firebird のデータベースに接続しようとしていることです。firebird をインストールしました (現在 /opt/firebird にあります)。 .fdb) テーブル付き (firebird では正常に動作します)
create table languages
(
name varchar(20),
year_released integer
);
insert into languages (name, year_released) values ('C', 1972);
insert into languages (name, year_released) values ('Python', 1991);
しかし、pydevで実行しようとすると問題が発生します。
import fdb
con = fdb.connect(dsn="/tmp/test.fdb", user="fernando", password="root")
# Create a Cursor object that operates in the context of Connection con:
cur = con.cursor()
# Execute the SELECT statement:
cur.execute("select * from languages")
# Retrieve all rows as a sequence and print that sequence:
print cur.fetchall()
http://www.firebirdsql.org/file/documentation/drivers_documentation/python/fdb/getting-started.html
データベースの現在の場所は /tmp にあります。ここからダウンロードした fdb を使用しています: https://pypi.python.org/pypi/fdb/、pip でインストールしました。また、pydev properties->pydev pythonpath で使用し、フォルダーを追加しました私のユーザー名はfernandoで、パスワードはrootなので、最終的に実行すると、次のエラーメッセージが表示されます。
Traceback (most recent call last):
File "/home/elfstone/Documents/workspace/NuevosPython/fire.py", line 3, in <module>
con = fdb.connect(dsn="/tmp/test.fdb", user="fernando", password="root")
File "/home/elfstone/Downloads/fdb-1.4/fdb/fbcore.py", line 693, in connect
"Error while connecting to database:")
fdb.fbcore.DatabaseError: ('Error while connecting to database:\n- SQLCODE: -902\n- Unable to complete network request to host "localhost".\n- Failed to establish a connection.', -902, 335544721)
これはどのように修正できますか?助けて感謝します。