由于 reactive.url 不正确,无法使用 quarkus-hibernate-reactive 连接到 SQL 服务器

Unable to connect to SQL Server using the quarkus-hibernate-reactive due to incorrect reactive.url

我曾在连接到 Postgres 的 Quarkus 上工作过。但这是我第一次尝试连接到 SQL 服务器,这是我当前项目中的默认服务器。我正在按照此 guide 创建数据库组件。

属性文件包含以下内容:

quarkus.datasource.db-kind=mssql 
quarkus.datasource.username=<user-id>
quarkus.datasource.password=<pwd>

quarkus.datasource.reactive.url=sqlserver://localhost:1433/<db-name>?currentSchema=<schema-name>
quarkus.datasource.reactive.max-size=20 
hibernate.default_schema=<schema-name>

应用程序启动正常,但是当我向内部使用存储库的资源发出请求时,出现以下错误:

Internal Server Error

Error id f0a959d2-3201-4015-bfd7-6628ae9914d1-1, io.vertx.mssqlclient.MSSQLException: {number=208, state=1, severity=16, message='Invalid object name ''.', serverName='<sql-instance>', lineNumber=1, additional=[io.vertx.mssqlclient.MSSQLException: {number=8180, state=1, severity=16, message='Statement(s) could not be prepared.', serverName='<sql-instance>', lineNumber=1}]}

这意味着,我的应用程序能够连接到数据库,但无法找到 table。 table 存在于模式中,我无法传递可能导致问题的模式。如果您检查属性文件,我尝试了两个选项:

但是两个选项中的 none 都有效。 SQL 服务器上没有可以帮助我为 Quarkus 应用程序提供正确配置的文档。请帮忙。

正确的 属性 是 quarkus.hibernate-orm.database.default-schema 可以检查此 url https://quarkus.io/guides/hibernate-orm#hibernate-configuration-properties

中所有可用的配置属性