我正在尝试从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/