我正在尝试使用 Flyway-Commandline 连接到 Oracle 集群。它可以在 DOS 上正常工作,使用:
# Ommitting the other params for brevity: jarDir, locations, user, password, driver etc
flyway clean -url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST = my_host_1)(PORT=8020))(ADDRESS=(PROTOCOL=TCP)(HOST = my_host_2)(PORT=8020))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MY_SERVICE_NAME)))"
但是当我在 linux 上做同样的事情时,我得到一个错误:
ERROR: FlywayException: Unable to obtain Jdbc connection from DataSource
ERROR: Occured in com.googlecode.flyway.core.util.jdbc.JdbcUtils.openConnection() at line 56
ERROR: Caused by oracle.net.ns.NetException: NL Exception was generated
ERROR: Occured in oracle.net.resolver.AddrResolution.resolveAddrTree() at line 626
如果我直接使用以下方法直接连接到其中一个主机,它在两个平台上都可以正常工作:
flyway clean -url=jdbc:oracle:thin:@my_host_1:8020/MY_SERVICE_NAME
问题是,当集群中的一台主机出现故障时(这种情况经常发生),它就会停止工作。