文件“3050/var/lib/firebird/data/corp”的 CreateFile打开操作期间出现 I/O 错误系统找不到指定的路径

问题描述

我在尝试使用 SymmetricDS 连接到 Firebird 3.0 时遇到错误“系统找不到指定的路径”。这是错误和我的根节点配置(engine.name=corp-000)。

# The class name for the JDBC Driver 
db.driver=org.firebirdsql.jdbc.FBDriver

# The JDBC URL used to connect to the database
db.url=jdbc:firebirdsql:localhost:3050/var/lib/firebird/data/corp

这是我得到的错误

enter image description here

我尝试启用 SymmetricDS 文档中所述的旧身份验证,但无济于事:

解决方法

问题是您使用了错误的 JDBC url。 Jaybird 本质上有两种 URL 格式,一种与旧版 Firebird URL 格式相匹配,另一种更符合标准 URL 和其他 JDBC 驱动程序使用的 URL。您当前的 URL 结合了两种格式的一部分,因此它不起作用,因为使用您使用的格式,它会将 3050/var/lib/firebird/data/corp 解释为文件路径(这会导致 “系统找不到指定路径” 错误),而不是端口 3050 和文件路径 /var/lib/firebird/data/corp

您需要使用推荐的格式

jdbc:firebirdsql://localhost:3050//var/lib/firebird/data/corp

注意端口后面的双斜线 (//),这是必要的,否则路径将被解释为相对路径 var/lib/...,这不是您想要的。

或者没有端口(因为 3050 是默认值):

jdbc:firebirdsql://localhost//var/lib/firebird/data/corp

或旧格式

jdbc:firebirdsql:localhost/3050:/var/lib/firebird/data/corp

注意主机和端口之间的斜线 (/) 和端口后面的冒号 (:)。

或者没有端口(因为 3050 是默认值):

jdbc:firebirdsql:localhost:/var/lib/firebird/data/corp

另请参阅 Jaybird 常见问题解答 中的 JDBC URLs (java.sql.DriverManager)Jaybird JDBC 驱动程序 Java 程序员手册中的 Obtaining connection java.sql.DriverManager(尽管这仅记录了推荐的 URL 格式)。