Opening a Firebird database file on a network share

丶灬走出姿态 提交于 2019-12-02 04:02:24

1. Firebird explicitly denies attempts to open database files on non-local disks

Firebird is database server, and as such it focuses on performance and reliability.

http://www.firebirdfaq.org/faq46/

Performance means lots of data is cached, both cached for reading and cached for writing.

Reliability means Firebird has to gain worthy warrants from OS that:

a. no other process would tinker with the database file while the server has some data from it cached for reading.

b. at any moment in time the server might wish to write any data to the file from its cache and it is warranted that that data - at any moment in time - ends persistently written to the persistent media.

Network-connected disks nullify both warranties and consequently Firebird Server refuses to trust them.

You may hack Firebird configuration or source files on your own discretion to remove this safety check and open network-shared files, if you really need this more than safety and speed.

But proper solution would be installing Firebird server on the machine whose disks do carry the database file.

2. Connection String is not a database file name

AGDBName := '\\tt2012server\persoonlijk\jan\klanten.gdb'

This does NOT mean "local Firebird server should connect to tt2012server server using LOCAL_SYSTEM credentials and read the database file from persoonlijk shared resource", as you probably intended it to mean.

http://www.firebirdfaq.org/faq260/

If anything, Windows LOCAL_SYSTEM user is explicitly barred from most network operations to contain intruders and viruses. Even if you hack Firebird into opening network files, most probably Windows would prohibit this access anyway, unless you would setup your Windows to run Firebird Server service with some user account other than the default LOCAL_SYSTEM.

Anyway, what \\tt2012server\persoonlijk\jan\klanten.gdb Connection String actually means is that you request your application to connect to tt2012server using WNET (aka Microsoft Named Pipes) protocol and find Firebird server running on that server and communicating by WNET protocol, as opposed to TCP/IP protocol.

Judging by the error you quote - lUNC := '\\2012server'; // Unable to complete network request to host - the said tt2012server computer perhaps does not have a Firebird Server running and accepting Named Pipes connections.

The WNET protocol is considered obsoleted and would most probably be removed from the future Firebird Server versions. As of now it is working, but few people use it, thus little up to date experience exists in that area. It is suggested you would use TCP/IP protocol by default to connect your application to the Firebird Server running on the tt2012server machine, not WNET protocol.

PS. This question has duplicates:

PPS. Firebird is a multi-generation database engine.

Consequently, there is no "dirty read" transactions possible in Interbase/Yaffil/Firebird family.

TxOptions.Isolation := xiDirtyRead; - this line would not work. Most probably it would silently change the transaction class to "READ COMMITTED", less probably it would give an explicit error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!