gpt4 book ai didi

python - 我无法从 Python 连接到 FDB 数据库

转载 作者:行者123 更新时间:2023-12-01 04:50:43 24 4
gpt4 key购买 nike

我正在尝试从 Python 连接到 Firebird DB。我正在使用 FDB 模块。

import fdb
con = fdb.connect(host='10.7.0.115',database=r'C:\ProgramData\Entensys\UserGate6\USERGATE.FDB', user='SYSDBA', password='masterkey',charset='UTF8' )


cur = con.cursor()
cur.execute("select * from baz")
for c in cur.fetchall():
print(c)
conn.close()

但是,我收到错误:

Traceback (most recent call last):
File "C:\Python34\fdb_test.py", line 4, in <module>
con = fdb.connect(host='10.7.0.115',database=r'C:\ProgramData\Entensys\UserGate6\USERGATE.FDB', user='SYSDBA', password='masterkey',charset='UTF8' )
File "C:\Python34\lib\site-packages\fdb\fbcore.py", line 653, in connect
load_api()
File "C:\Python34\lib\site-packages\fdb\fbcore.py", line 183, in load_api
setattr(sys.modules[__name__],'api',fbclient_API(fb_library_name))
File "C:\Python34\lib\site-packages\fdb\ibase.py", line 1173, in __init__
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, baseKey)
FileNotFoundError: [WinError 2] Can not find the specified file

这个文件存在。我知道。

最佳答案

您需要在系统上安装fbclient.dll,不需要完整的服务器(您可以在安装时取消选中)

http://www.firebirdsql.org/en/firebird-2-5/

关于python - 我无法从 Python 连接到 FDB 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28556950/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com