我有一个 firebird DB 图像在端口 3050 上运行,我需要通过 url 访问该图像内的文件,这样我就可以创建一个 firebird 连接(是的 firebird 需要一个文件路径),但我无法使用网址 有没有办法在 docker 中公开文件,并使其可以通过 url 访问?示例 localhost:3050/databases/test.fdb << 我需要通过 dbeaver 连接到此
its runnning normally on the 3050
heres the file I need to access via url (thats inside the container) (位于/databases)
最佳答案
需要使用绝对路径/databases/DREAMCLUB.FDB
,而不是相对路径 databases/DREAMCLUB.FDB
。另请参阅Jaybird FAQ on JDBC URLs (Jaybird 是 DBeaver 使用的 Firebird JDBC 驱动程序):
On Linux the root
/
should be included in the path. A database located on/opt/firebird/db.fdb
should use (note the double slash after port!):jdbc:firebirdsql://host:port//opt/firebird/db.fdb
Jaybird JDBC Driver Java Programmer's Manual 中也有类似的提及:
On Unix platforms the path must include the root, as the path is otherwise interpreted relative to a server-dependent folder. Having to include the root has the effect that a database in
/var/firebird/employee.fdb
needs to use a double//
after the host name (and port) in the connection string:jdbc:firebirdsql://localhost//var/firebird/employee.fdb
顺便说一句,Firebird 不要求您使用文件路径,您也可以在 aliases.conf
中定义别名。 (Firebird 2.5 及更早版本)或 databases.conf
(Firebird 3.0 及更高版本)。
关于docker - 如何使用 docker 文件路径连接到 firebird 的 docker 镜像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70626882/