oracle Sql开发者自定义连接字符串

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27653598/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 00:43:29  来源:igfitidea点击:

Sql developer custom connection string

oracledatabase-connectionconnection-stringoracle-sqldeveloper

提问by user1570345

How to use custom connection string in Oracle sql developer to connect?

如何在Oracle sql developer中使用自定义连接字符串进行连接?

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=147.22.109.218)(port=1521))(ADDRESS=(PROTOCOL=TCP)
(HOST=147.22.109.219)(port=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=147.22.109.220)(port=1521)))
(FAILOVER=on)(LOAD_BALANCE=on)
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=cmphpd)))

Please help. Thanks

请帮忙。谢谢

回答by Gagandeep Sharma

These are the best and complete instructions I've found. https://blogs.oracle.com/dev2dev/ssl-connection-to-oracle-db-using-jdbc,-tlsv12,-jks-or-oracle-wallets

这些是我发现的最好和完整的说明。 https://blogs.oracle.com/dev2dev/ssl-connection-to-oracle-db-using-jdbc,-tlsv12,-jks-or-oracle-wallets

Below are the steps which I took to fix this issue:

以下是我为解决此问题而采取的步骤:

  1. Install JCE (following the instructions in Readme) - JCE
  2. Add below lines in build.gradle

    System.setProperty('oracle.net.ssl_version', '1.2') System.setProperty('oracle.net.ssl_cipher_suites', '(TLS_RSA_WITH_AES_256_CBC_SHA256)') System.setProperty('oracle.net.tns_admin', './lib') System.setProperty('oracle.net.ssl_server_dn_match', 'true')

  3. Setup db connection like

    String connString = "jdbc:oracle:thin:@(description=(address_list= (address=(protocol=tcp)(port=1521)(host=prodHost))) (connect_data=(INSTANCE_NAME=ORCL)))"; OracleDataSource ods = new OracleDataSource(); ods.setURL(connString); ods.setUser("scott"); ods.setPassword("tiger"); Connection conn = ods.getConnection();

  1. 安装 JCE(按照自述文件中的说明进行操作)- JCE
  2. 在 build.gradle 中添加以下几行

    System.setProperty('oracle.net.ssl_version', '1.2') System.setProperty('oracle.net.ssl_cipher_suites', '(TLS_RSA_WITH_AES_256_CBC_SHA256)') System.setProperty('oracle.net.tns_admin', './lib') System.setProperty('oracle.net.ssl_server_dn_match', 'true')

  3. 设置数据库连接,如

    String connString = "jdbc:oracle:thin:@(description=(address_list= (address=(protocol=tcp)(port=1521)(host=prodHost))) (connect_data=(INSTANCE_NAME=ORCL)))"; OracleDataSource ods = new OracleDataSource(); ods.setURL(connString); ods.setUser("scott"); ods.setPassword("tiger"); Connection conn = ods.getConnection();

回答by bmaupin

To us a TNS connection string, in the New / Select Database Connectionwindow where you configure the connection:

给我们一个 TNS 连接字符串,在您配置连接的新建/选择数据库连接窗口中:

  1. Set Connection Typeto TNS
  2. Under the Detailstab select Connect Identifier
  3. Put the connection string into the text box next to Connect Identifier
  4. Click Testif you'd like, to make sure it works
  5. Click Save
  1. 连接类型设置为TNS
  2. 详细信息选项卡下选择连接标识符
  3. 将连接字符串放入连接标识符旁边的文本框中
  4. 如果您愿意,请单击“测试”以确保其有效
  5. 点击保存

Similarly, under Connection Typethere also seems to be an option for a custom JDBC URL if that's what you prefer.

同样,在Connection Type下,如果您愿意,似乎也有一个自定义 JDBC URL 选项。

(Instructions and screenshot from version 19.4, in case it makes a difference)

(版本 19.4 的说明和屏幕截图,以防万一)

enter image description here

在此处输入图片说明

回答by raz

Try this:

尝试这个:

jdbc:oracle:thin:@147.22.109.220:1521/cmphpd