| ■ | Interbase/FirebirdのPythonインターフェース・kinterbasdb |
●Windowsへのインストール
次の環境で試しました。Firebird 1.0.0です。
| プラットフォーム | kinterbasdb | Python |
|---|---|---|
| MS-Windows XP Home Edition | 3.1pre2 | 2.1 |
| MS-Windows XP Home Edition | 3.1pre2 | 2.2 |
●サンプルプログラム
import kinterbasdb con = kinterbasdb.connect(dsn="localhost:c:/usr/dbms/fb/udb.gdb", user="urano", password="urano398", charset="SJIS") # カーソルの作成 cur = con.cursor() # SQL文で問い合わせを実行します。 s = "SELECT SHITEN_CODE, SHITEN_NAME, ADDRESS, EMPLOYEE_NUM FROM SHITEN" cur.execute(s) # 結果を1行ずつ取得 r = cur.fetchone() while r != None: print "%-10s | %-10s | %-40s | %d" % r r = cur.fetchone() # カーソルを閉じます。 cur.close() # closeメソッドでデータベース接続を終了します。 con.close() # end. |
セクションのサブメニューに戻る
(first uploaded 2003/01/27 last updated (not ever))