从Windows本地网络连接到Firebird数据库 [英] Connecting to Firebird database from Windows local network
问题描述
我已经写了一个小型的Python应用程序了几周了.该应用程序从Firebird数据库读取数据,并将其复制到另一个DB.我正在使用内嵌Firebird的FDB.
这是我的连接代码.
I have been writing a small Python app for several weeks. The application reads data from a Firebird database and it copies it to another DB. I'm using FDB with Firebird embedded.
This is my connection code.
def createConnectionTo(path):
try:
connection = fdb.connect(
database=path,
user='SYSDBA',
password='masterkey',
charset='WIN1252'
)
print("Connessione al database riuscita!\n")
return connection
except fdb.fbcore.DatabaseError as details:
errorMsg = "ERRORE: impossibile connettersi al database!\nPer favore scegliere un altro file.\n\nDETTAGLI\n"+str(details).replace("\\n", "\n")+"\n"
print(errorMsg)
return False
except fdb.fbcore.ProgrammingError as details:
errorMsg = "ERROR: bad parameters value!\nPlease check your connection code.\nDETAILS: "+str(details)+"\n"
print(errorMsg)
return False
except Exception as errorMsg:
print("ERRORE: "+str(errorMsg))
input("Premi un ENTER per chiudere la finestra.")
return -1
此代码适用于计算机内部的文件夹,但莫名其妙地不适用于我们本地网络中共享的文件夹.我使用了 os. path.exists()检查Python是否能够找到所选的共享文件夹,并且始终返回True.
我一直收到此错误,而且不知道如何解决它,即使我怀疑这与斜杠转换问题有关.
This code works for folders inside my computer, but inexplicably it doesn't work for folders shared in our local network. I used os.path.exists() to check whetever Python was able to find the selected shared folders and it always returned True.
I keep getting this error and I don't have any clue how to solve it, even if I suspect that it is somewhat related to a slash conversion issue.
('Error while connecting to database:
- SQLCODE: -902
- I/O error during "CreateFile (open)" operation for file "Danea Easyfatt\\ANYMA 2017 dal 06-02-17.eft"
- Error while trying to open file
- Impossibile trovare il percorso specificato. ', -902, 335544344)
我尝试了以下所有方式来键入路径:
I tried all the following way to type the path:
- \\ CENTRALE \ Danea Easyfatt \ ANYMA 2017年6月2日至17日
- //CENTRALE/Danea Easyfatt/ANYMA 2017 dal 06-02-17.eft
- \\\ CENTRALE \\ Danea Easyfatt \\ ANYMA 2017年6月2日至17日.
他们都没有工作.
推荐答案
您无法访问网络共享上的数据库. Firebird明确禁止使用此 * .但是,据我所知,显示的错误仅表示您正在尝试使用无效的路径来访问文件.
You cannot access databases on a network share. Firebird explicitly disallows this*. However, as far as I can tell, the error you display simply means you're trying to use an invalid path to access file.
如果要通过网络连接到Firebird数据库,则应连接到托管该数据库的系统上的Firebird服务器.这意味着要运行Firebird服务器,而不要使用Firebird Embedded.
If you want to connect to a Firebird database over a network, you should connect to a Firebird server on the system hosting the database. That means running Firebird server, not using Firebird Embedded.
*:您可以将Firebird配置为允许在网络驱动器上打开数据库,但是如果多个进程试图从不同主机修改数据库,这是破坏数据库的好方法,这是您实际上不应该执行的操作
这篇关于从Windows本地网络连接到Firebird数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!