如何为PostgreSQL jdbc数据源启用故障转移

问题描述 投票:0回答:1

我在Liberty应用程序服务器中为Postgresql定义了一个数据源

<dataSource jdbcDriverRef="PostgreSQLDriver" ...>
  <properties password="..." user="admin" serverName="server" portNumber="2020" databaseName="dbname" ssl="false"
</dataSource>

[我看到我可以通过指定如下网址来启用jdbc连接上的故障转移:

jdbc:postgresql://host1:port,host2:port,host3:port/dbname

可以通过任何方式将此故障转移URL提供给应用程序服务器数据源吗?

postgresql jdbc datasource websphere-liberty failover
1个回答
0
投票

是,可以在<properties>元素上指定任何键/值对,Liberty将其提供给供应商数据源类。在这种情况下,属性将为URL="jdbc:postgresql://host1:port,host2:port,host3:port/dbname"

此外,请注意,在最新的Liberty版本中,有一个properties.postgresql专用于Postgres,更好的是documents可用的设置。

这里是一个例子,

<dataSource jdbcDriverRef="PostgreSQLDriver" ...>
  <properties.postgresql password="..." user="admin" URL="jdbc:postgresql://host1:port,host2:port,host3:port/dbname" ssl="false"
</dataSource>
© www.soinside.com 2019 - 2024. All rights reserved.