Python论坛  - 讨论区

标题:[python-chinese] 使用python连接Embedded Firebird没试成功,指点一下

2005年09月09日 星期五 00:44

lihui lihuimail at gmail.com
Fri Sep 9 00:44:23 HKT 2005

不用Embedded方式可以成功连接。

按下面的文档测试,出现-904错误,请指点一下,谢谢

Using KInterbasDB with Embedded Firebird (Windows Only)
The Firebird 1.5 Release Notes (ReleaseNotes.pdf, included with RC5
and later) describe Embedded Firebird as "a DLL that merges a single
client attachment with a Firebird Superserver for building very quick
and efficient stand-alone and briefcase applications." Practically
speaking, Embedded Firebird allows an application to use the database
engine without managing an external server process. This is ideal for
applications that will be distributed to end users, or that must be
deployed on operating systems that support background services poorly,
such as Win9x.

The KInterbasDB distribution linked against the Firebird 1.5 client
library fbclient.dll (kinterbasdb-V.V.win32-FB1.5-pyV.V) works fine
with Embedded Firebird. Only local-protocol connections are supported,
of course, and some of the standalone-server-oriented features of the
Services API are not supported.

For generic Embedded Firebird configuration instructions, refer to the
section of the Firebird 1.5 Release Notes entitled "Installing
Embedded server from a zip kit" (page 51 of the ReleaseNotes.pdf
accompanying Firebird 1.5.0).

Below are specific instructions for installing Embedded Firebird 1.5.0
for use with Python 2.3 and KInterbasDB 3.1. These instructions assume
that there are no existing installations of Firebird or KInterbasDB on
your system.

Extract the file kinterbasdb-V.V-win32-all-binaries-manual-pack.zip to
a temporary directory. Copy the kinterbasdb directory from
kinterbasdb-V.V-win32-all-binaries-pack\firebird-1.5\lib.win32-2.3 to
a directory on the PYTHONPATH of the python.exe you intend to use
Embedded Firebird with (e.g.,
the-directory-of-python.exe\Lib\site-packages).

Embedded Firebird is determined to use the directory of the
application's executable as its root directory. For Python
applications, this is the directory in which python.exe (or
pythonw.exe) resides. It is supposedly possible to manually override
the Embedded Firebird root directory setting, but that option doesn't
work consistently if esoteric engine features are used.

Extract Firebird-1.5.0.4290_embed_win32.zip to a temporary directory.
Copy the files fbembed.dll, firebird.msg, and ib_util.dll to the
directory in which python.exe resides. If you intend to use character
sets other than ASCII, also copy the intl subdirectory, which contains
fbintl.dll.

Rename fbembed.dll to fbclient.dll. 

You should now have the following file structure: 

the-directory-of-python.exe\
  [python.exe, and other Python-related files]
  fbclient.dll
  firebird.msg
  ib_util.dll
  intl\         <--only necessary if using character sets other than ASCII
    fbintl.dll  <--^


Run your KInterbasDB-based Python application. The database engine is
"embedded" within the same process as your application; no external
server process is necessary, and no code changes are required.



---------------------------------------------------------------------
这是测试结果:
>>> conn=kinterbasdb.connect(dsn='c:/EMPLOYEE.FDB',user='sysdba',password='maste
('c:/EMPLOYEE.FDB', '\x01\x1c\x06sysdba\x1d\tmasterkey', 3)
Traceback (most recent call last):
  File "", line 1, in ?
  File "C:\PYTHON23\lib\site-packages\kinterbasdb\__init__.py", line 476, in con
nect
    return Connection(*args, **keywords_args)
  File "C:\PYTHON23\lib\site-packages\kinterbasdb\__init__.py", line 615, in __i
nit__
    self._C_con = _k.attach_db(dsn, dpb, dialect)
kinterbasdb.OperationalError: (-904, 'isc_attach_database: unavailable database.
 ')
>>>



-- 
my gmail:lihuimail(at)gmail.com
WukooPy:
http://wiki.woodpecker.org.cn/moin/WukooPy
http://groups-beta.google.com/group/python-wukoopy

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号