0

我正在尝试将我的 Teamcity 数据库从内部迁移到外部,并且我注册了一个免费层 ATP 数据库。我不确定如何在 teamcity 数据库属性文件中设置连接 URL 以访问数据库。

我引用的 tnsnames 来自以下内容:

teamcitytestdb_medium = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name=rhhea6hkgj2saju_teamcitytestdb_medium.atp.oraclecloud.com))(security=(ssl_server_cert_dn="CN=adwc.uscom-east-1.oraclecloud.com,OU=Oracle BMCS US,O=Oracle Corporation,L=Redwood City,ST=California,C=US")))

我为以下测试运行的命令正在使用此命令:

bin/maintainDB.sh migrate -T $(pwd)/database.oracle.autodb.properties.dist

这是我尝试过的命令和输出列表:

测试1:

connectionUrl=jdbc:oracle:thin:@//adb.us-phoenix-1.oraclecloud.com:1522/rhhea6hkgj2saju_teamcitytestdb_high.atp.oraclecloud.com
driverName=oracle.jdbc.driver.OracleDriver
connectionProperties.user=<username>
connectionProperties.password=<password>

--------- output ---------
Cannot proceed with 'migrate' command: Could not connect to the target database: Could not connect to Oracle server.
IO Error: Got minus one from a read call: java.sql.SQLRecoverableException: IO Error: Got minus one from a read call. Caused by: oracle.net.ns.NetException: Got minus one from a read call

测试2:

connectionUrl=jdbc:oracle:thin:@tcps://adb.us-phoenix-1.oraclecloud.com:1522/rhhea6hkgj2saju_teamcitytestdb_high.atp.oraclecloud.com?wallet_location=/Users/jiuwang/Documents/Spectra/3rd-jars/teamcity-tests/Wallet_TeamCityTestDB
driverName=oracle.jdbc.driver.OracleDriver
connectionProperties.user=<username>
connectionProperties.password=<password>

--------- output ---------
Cannot proceed with 'migrate' command: Could not connect to the target database: Could not connect to Oracle server.
IO Error: The Network Adapter could not establish the connection: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection. Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection

测试3:

connectionUrl=jdbc:oracle:thin:@adb.us-phoenix-1.oraclecloud.com:1522:rhhea6hkgj2saju_teamcitytestdb_medium.atp.oraclecloud.com
driverName=oracle.jdbc.driver.OracleDriver
connectionProperties.user=<username>
connectionProperties.password=<password>

--------- output ---------
Cannot proceed with 'migrate' command: Could not connect to the target database: Could not connect to Oracle server.
IO Error: Got minus one from a read call: java.sql.SQLRecoverableException: IO Error: Got minus one from a read call. Caused by: oracle.net.ns.NetException: Got minus one from a read call

我应该如何正确设置它以便迁移工具可以连接到数据库?谢谢

4

1 回答 1

0

您需要提供 TNS_ADMIN 以指向下载钱包凭据以连接到自治数据库的路径。此外,JDBC 版本也很重要。仅当您使用 JDBC 驱动程序版本 18.3 及更高版本时,才能将传递 TNS_ADMIN 作为连接 URL 的一部分。

我建议尝试DataSourceSample.java以确保连接是否有效。

DB_URL ="jdbc:oracle:thin:@wallet_dbname?TNS_ADMIN=/Users/test/wallet_dbname";

此外,请参阅此页面了解更多详细信息。

于 2020-06-29T14:30:01.597 回答