oracle数据库建立连接数据库服务器端,创建 Oracle Database 连接 URI

创建 Oracle Database 连接 URICreate the Oracle Database connection URI

06/08/2017

本文内容

用于 Oracle 数据库的 Microsoft BizTalk 适配器Microsoft BizTalk Adapter for Oracle Database连接 URI 包含适配器用于建立与 Oracle 数据库的连接的属性。The 用于 Oracle 数据库的 Microsoft BizTalk 适配器Microsoft BizTalk Adapter for Oracle Database connection URI contains properties that the adapter uses to establish a connection to the Oracle database. 本主题提供有关如何使用 tnsnames.ora 指定连接 URI 以连接到 Oracle 数据库以及不使用 tnsnames.ora. tnsnames.ora 的信息。This topic provides information about how to specify the connection URI to connect to the Oracle database using tnsnames.ora and without using tnsnames.ora. 它还提供了有关使用连接 URI 连接到 Oracle 数据库的信息。It also provides information about using the connection URI to connect to the Oracle database.

使用 tnsnames.ora 连接到 Oracle Database 的连接 URI。 tnsnames.oraConnection URI to Connect to the Oracle Database Using tnsnames.ora

重要

对于此方法,必须在安装了适配器客户端的计算机上的 tnsnames.ora 文件中添加 net service name 条目。For this approach, you must add the net service name entry in the tnsnames.ora file on the computer with the adapter client installed. 有关 net service name 条目的详细信息,请参阅为 Oracle Database 适配器配置 Oracle 客户端。For more information about the net service name entry, see Configure the Oracle Client for the Oracle Database adapter.

由于 Oracle 客户端限制,如果在事务中执行操作,则连接 URI 中 (net service name ) 的网络名称参数不 能超过39个字符。Due to an Oracle Client limitation, the DataSourceName parameter (net service name) in the connection URI cannot contain more than 39 characters if you are performing operations in a transaction. 因此,如果要在事务中执行操作,请确保 为 "值类型" 参数 指定的值小于或等于39个字符。Therefore, make sure that the value specified for the DataSourceName parameter is less than or equal to 39 characters if you will be performing operations in a transaction.

中的典型终结点地址 URI WCFWCF 表示为: scheme://userauthparams@hostinfoparams?query_string ,其中:A typical endpoint address URI in WCFWCF is represented as: scheme://userauthparams@hostinfoparams?query_string, where:

方案为方案名称。scheme is the scheme name.

userauthparams 是终结点进行用户身份验证所需的参数的名称-值集合。userauthparams is a name-value collection of parameters required for user authentication by the endpoint.

hostinfoparams 是与主机建立连接所需的信息;例如,路径。hostinfoparams is information required to establish the connection to the host; for example, a path.

query_string 是由问号 (? ) 分隔的参数的可选名称-值集合。query_string is an optional name-value collection of parameters delimited by a question mark (?).

Oracle 数据库适配器Oracle Database adapter连接 URI 遵循这种基本格式,并按如下所示实现:The Oracle 数据库适配器Oracle Database adapter connection URI adheres to this basic format and is implemented as follows:

oracledb://User=[USER_NAME];Password=[PASSWORD]@[NET_SERVICE_NAME]?PollingId=[POLLING_ID]

下表说明了连接 URI 中包含的属性。The following table explains the properties contained in the connection URI.

连接 URI 属性Connection URI Property

类别Category

描述Description

[USER_NAME][USER_NAME]

userauthparamsuserauthparams

用于在 Oracle 数据库上进行身份验证的用户名;例如,SCOTT。The user name to use for authentication on the Oracle database; for example, SCOTT. 您必须将 AcceptCredentialsInUri 绑定属性设置为 true ,才能指定连接 URI 中的用户名和密码。You must set the AcceptCredentialsInUri binding property to true to specify the user name and password in the connection URI.

注意Oracle 数据库适配器Oracle Database adapter保留在 Oracle 数据库上打开连接时为用户名输入的值的大小写。Note The Oracle 数据库适配器Oracle Database adapter preserves the case of the value that you enter for the user name when it opens a connection on the Oracle database. Oracle 数据库上的用户名区分大小写。User names on the Oracle database are case-sensitive. 应确保 Oracle 数据库适配器Oracle Database adapter 在 oracle 数据库所需的情况下向提供 oracle 用户名。You should ensure that you provide Oracle user names to the Oracle 数据库适配器Oracle Database adapter in the case expected by your Oracle database. 通常,这意味着 SCOTT/TIGER 凭据中的用户名应大写: "SCOTT"。Typically, this means that the user name in the SCOTT/TIGER credential should be upper case: "SCOTT".

权限[PASSWORD]

userauthparamsuserauthparams

用于在 Oracle 数据库上进行身份验证的密码;例如,TIGER。The password to use for authentication on the Oracle database; for example, TIGER. 您必须将 AcceptCredentialsInUri 绑定属性设置为 true ,才能指定连接 URI 中的用户名和密码。You must set the AcceptCredentialsInUri binding property to true to specify the user name and password in the connection URI.

注意 在 Oracle 数据库适配器Oracle Database adapter Oracle 数据库上打开连接时,保留为密码输入的值的大小写。Note The Oracle 数据库适配器Oracle Database adapter preserves the case of the value that you enter for the password when it opens a connection on the Oracle database. 对于发行版 10g 和更早版本,Oracle 系统中的密码不区分大小写。For release 10g and earlier, passwords on the Oracle system are not case-sensitive.

[NET_SERVICE_NAME][NET_SERVICE_NAME]

hostinfoparamshostinfoparams

在安装了的计算机上的 tnsnames.ora. tnsnames.ora 文件中指定的网络服务名称 Oracle 数据库适配器Oracle Database adapter 。A net service name that is specified in the tnsnames.ora file on the computer where the Oracle 数据库适配器Oracle Database adapter is installed. 有关 net 服务名称和 tnsnames.ora. tnsnames.ora 的详细信息,请参阅为 Oracle Database 适配器配置 Oracle 客户端。For more information about net service names and tnsnames.ora, see Configure the Oracle Client for the Oracle Database adapter.

[POLLING_ID][POLLING_ID]

query_stringquery_string

应将适配器追加到 POLLINGSTMT 操作的标准命名空间的可选字符串。An optional string that should be appended by the adapter to the standard namespace of the POLLINGSTMT operation. 这使您可以在项目包含多个轮询操作时为每个轮询操作指定唯一的命名空间。This enables you to specify a unique namespace for each polling operation when a project contains multiple polling operations. 如果项目仅包含一个 POLLINGSTMT 操作,则无需指定 PollingId 字符串。You do not have to specify a PollingId string if your project contains only one POLLINGSTMT operation.

备注

如果为 WCFWCF 元数据交换客户端指定了终结点地址,则还会在连接 URI 中使用查询参数。Query parameters are also used in the connection URI when an endpoint address is specified for a WCFWCF Metadata Exchange client.

连接到 Oracle Database 的连接 URI,无需使用 tnsnames.ora. tnsnames.oraConnection URI to Connect to the Oracle Database Without Using tnsnames.ora

重要

对于这种方法,tnsnames.ora 文件中的 net service 名称或实际的 tnsnames.ora 文件本身不需要存在于客户端计算机上。For this approach, the net service name in the tnsnames.ora file, or the actual tnsnames.ora file itself does not need to be present on the client computer.

如果在事务中执行操作,则不支持此连接模式。This mode of connectivity is not supported if you are performing operations in a transaction. 这是因为 Oracle 客户端的限制。This is due to a limitation of Oracle Client.

中的典型终结点地址 URI WCFWCF 表示为: scheme://userauthparams@hostinfoparams?query_string ,其中:A typical endpoint address URI in WCFWCF is represented as: scheme://userauthparams@hostinfoparams?query_string, where:

方案为方案名称。scheme is the scheme name.

userauthparams 是终结点进行用户身份验证所需的参数的名称-值集合。userauthparams is a name-value collection of parameters required for user authentication by the endpoint.

hostinfoparams 是与主机建立连接所需的信息;例如,服务器名称、端口号等。hostinfoparams is information required to establish the connection to the host; for example, server name, port number, etc.

query_string 是由问号 (? ) 分隔的参数的可选名称-值集合。query_string is an optional name-value collection of parameters delimited by a question mark (?).

Oracle 数据库适配器Oracle Database adapter连接 URI 遵循这种基本格式,并按如下所示实现:The Oracle 数据库适配器Oracle Database adapter connection URI adheres to this basic format and is implemented as follows:

oracledb://User=[USER_NAME];Password=[PASSWORD]@[SERVER_NAME]:[PORT_NUMBER]/[SERVICE_NAME]/SERVICE_TYPE]?PollingId=[POLLING_ID]

下表说明了连接 URI 中包含的属性。The following table explains the properties contained in the connection URI.

连接 URI 属性Connection URI Property

类别Category

描述Description

[USER_NAME][USER_NAME]

userauthparamsuserauthparams

用于在 Oracle 数据库上进行身份验证的用户名;例如,SCOTT。The user name to use for authentication on the Oracle database; for example, SCOTT. 您必须将 AcceptCredentialsInUri 绑定属性设置为 true ,才能指定连接 URI 中的用户名和密码。You must set the AcceptCredentialsInUri binding property to true to specify the user name and password in the connection URI.

注意Oracle 数据库适配器Oracle Database adapter保留在 Oracle 数据库上打开连接时为用户名输入的值的大小写。Note The Oracle 数据库适配器Oracle Database adapter preserves the case of the value that you enter for the user name when it opens a connection on the Oracle database. Oracle 数据库上的用户名区分大小写。User names on the Oracle database are case-sensitive. 应确保 Oracle 数据库适配器Oracle Database adapter 在 oracle 数据库所需的情况下向提供 oracle 用户名。You should ensure that you provide Oracle user names to the Oracle 数据库适配器Oracle Database adapter in the case expected by your Oracle database. 通常,这意味着 SCOTT/TIGER 凭据中的用户名应大写: "SCOTT"。Typically, this means that the user name in the SCOTT/TIGER credential should be upper case: "SCOTT".

权限[PASSWORD]

userauthparamsuserauthparams

用于在 Oracle 数据库上进行身份验证的密码;例如,TIGER。The password to use for authentication on the Oracle database; for example, TIGER. 您必须将 AcceptCredentialsInUri 绑定属性设置为 true ,才能指定连接 URI 中的用户名和密码。You must set the AcceptCredentialsInUri binding property to true to specify the user name and password in the connection URI.

注意 在 Oracle 数据库适配器Oracle Database adapter Oracle 数据库上打开连接时,保留为密码输入的值的大小写。Note The Oracle 数据库适配器Oracle Database adapter preserves the case of the value that you enter for the password when it opens a connection on the Oracle database. 对于发行版 10g 和更早版本,Oracle 系统中的密码不区分大小写。For release 10g and earlier, passwords on the Oracle system are not case-sensitive.

[SERVER_NAME][SERVER_NAME]

hostinfoparamshostinfoparams

运行 Oracle 数据库的服务器的名称。Name of the server on which the Oracle database is running. 必须设置此项。This is mandatory.

[PORT_NUMBER][PORT_NUMBER]

hostinfoparamshostinfoparams

Oracle Net 侦听器端口。The Oracle Net Listener port. 如果未指定任何值,则适配器将采用默认值1521。If no value is specified, the adapter takes the default value 1521.

[SERVICE_NAME][SERVICE_NAME]

hostinfoparamshostinfoparams

Oracle 数据库服务名称。The Oracle database service name. 必须设置此项。This is mandatory.

[SERVICE_TYPE][SERVICE_TYPE]

hostinfoparamshostinfoparams

Oracle 服务的类型。The type of Oracle service. 可能的值为 " 专用 " 或 " 共享"。The possible values are Dedicated or Shared. 专用服务使用专用服务器进程只为一个用户进程提供服务。A dedicated service uses a dedicated server process to serve only one user process. 共享服务使用可为多个用户进程提供服务的共享服务器进程。A shared service uses a shared server process that can that can serve multiple user processes. 默认值为“专用”。Default is Dedicated.

[POLLING_ID][POLLING_ID]

query_stringquery_string

应将适配器追加到 POLLINGSTMT 操作的标准命名空间的可选字符串。An optional string that should be appended by the adapter to the standard namespace of the POLLINGSTMT operation. 这使您可以在项目包含多个轮询操作时为每个轮询操作指定唯一的命名空间。This enables you to specify a unique namespace for each polling operation when a project contains multiple polling operations. 如果项目仅包含一个 POLLINGSTMT 操作,则无需指定 PollingId 字符串。You do not have to specify a PollingId string if your project contains only one POLLINGSTMT operation.

备注

如果为 WCFWCF 元数据交换客户端指定了终结点地址,则还会在连接 URI 中使用查询参数。Query parameters are also used in the connection URI when an endpoint address is specified for a WCFWCF Metadata Exchange client.

Oracle Database 凭据和连接 URIOracle Database Credentials and the Connection URI

默认情况下, Oracle 数据库适配器Oracle Database adapter 当在连接 URI 中指定 Oracle 数据库凭据时,将引发异常。By default, the Oracle 数据库适配器Oracle Database adapter throws an exception when the Oracle database credentials are specified in the connection URI. 这是因为这些凭据在连接 URI 中表示为纯文本,这会带来安全风险。This is because these credentials are represented as plain text in the connection URI, and this poses a security risk. 可以设置 AcceptCredentialsInUri 绑定属性来控制连接 URI 是否可以包含 Oracle 数据库的凭据。You can set the AcceptCredentialsInUri binding property to control whether the connection URI can contain credentials for the Oracle database. 如果 AcceptCredentialsInUri 属性为 false,则 Oracle 数据库适配器Oracle Database adapter 如果连接 URI 包含 Oracle 数据库凭据,则会引发异常; 如果该属性为 true,则不会引发异常。If the AcceptCredentialsInUri property is false, the Oracle 数据库适配器Oracle Database adapter throws an exception if the connection URI contains Oracle database credentials; if the property is true, no exception is thrown. 在某些情况下,有必要在连接 URI 中指定凭据;例如,若要在使用 WCF 服务模型或 WCF 通道模型时接收入站 POLLINGSTMT 操作。There are a few limited scenarios in which it is necessary to specify credentials in the connection URI; for example, to receive the inbound POLLINGSTMT operation when you use the WCF service model or the WCF channel model. 但在大多数情况下,应避免在连接 URI 中提供凭据。For most situations, however, you should avoid providing credentials in the connection URI. 有关如何更安全地为 Oracle 数据库提供凭据的详细信息,请参阅 保护 Oracle Database 应用程序。For more information about how to more securely provide credentials for the Oracle database, see Secure your Oracle Database applications.

重要

由于通过以纯文本形式传递字符串中的凭据引起的安全风险,因此应避免在连接 URI 中指定 Oracle 数据库连接凭据。Due to the security risks posed by passing credentials in strings as plain text, you should avoid specifying Oracle database connection credentials in the connection URI.

在连接 URI 中使用保留字符Using Reserved Characters in the Connection URI

不 Oracle 数据库适配器Oracle Database adapter 支持为任何参数值指定包含特殊字符的连接 URI。The Oracle 数据库适配器Oracle Database adapter does not support specifying a connection URI that has special characters for any of the parameter values. 如果连接参数值包含特殊字符,请确保执行下列操作之一:If the connection parameter values contain special characters, make sure you do one of the following:

如果使用或在中指定 URI Visual StudioVisual Studio 添加适配器服务参考加载项Add Adapter Service Reference Plug-in 使用适配器服务加载项Consume Adapter Service Add-in ,则必须在 " URI 属性 " 选项卡中按原样指定,即不使用任何转义符。If you are specifying the URI in Visual StudioVisual Studio using 添加适配器服务参考加载项Add Adapter Service Reference Plug-in or 使用适配器服务加载项Consume Adapter Service Add-in, you must specify them as-is in the URI Properties tab, that is, without using any escape characters. 如果直接在 " 配置 uri " 字段中指定 uri,并且连接参数包含保留字符,则必须使用正确的转义符指定连接参数。If you specify the URI directly in the Configure a URI field and the connection parameters contain reserved characters, you must specify the connection parameters using proper escape characters.

如果是在管理控制台中创建发送端口或接收端口时指定 URI BizTalk ServerBizTalk Server ,并且连接参数包含保留字符,则必须使用正确的转义字符指定连接参数。If you are specifying the URI while creating a send or receive port in BizTalk ServerBizTalk Server Administration console, and the connection parameters contain reserved characters, you must specify the connection parameters using proper escape characters.

使用连接 URI 连接到 Oracle DatabaseUsing the Connection URI to Connect to the Oracle Database

下面是的连接 URI 的示例 Oracle 数据库适配器Oracle Database adapter 。The following is an example of a connection URI for Oracle 数据库适配器Oracle Database adapter.

使用 tnsnames.ora. tnsnames.oraUsing tnsnames.ora

而不使用 tnsnames.ora. tnsnames.oraWithout using tnsnames.ora

oracledb://ADAPTER

在此示例中,适配器是一个网络服务名称,它与 tnsnames.ora. tnsnames.ora 中目标 Oracle 数据库的服务名称和连接信息相关联。In this example, ADAPTER is a net service name that is associated with the SERVICE NAME and connection information for the target Oracle database in tnsnames.ora.

oracledb://yourOracleServer:1521/yourOracleDatabaseServiceName/Dedicated

在此示例中,服务器名称为 "yourOracleServer",服务名称为 "yourOracleDatabaseServiceName"。In this example, the server name is “yourOracleServer” and the service name is “yourOracleDatabaseServiceName”.

下面是 POLLINGSTMT 操作的连接 URI 的示例。The following is an example of a connection URI for a POLLINGSTMT operation. 此 URI 包含 PollingId 参数,用于修改 POLLINGSTMT 操作的命名空间。This URI includes a PollingId parameter to modify the namespace of the POLLINGSTMT operation.

使用 tnsnames.ora. tnsnames.oraUsing tnsnames.ora

而不使用 tnsnames.ora. tnsnames.oraWithout using tnsnames.ora

oracledb://ADAPTER?PollingId=MyPollingNotification1

oracledb://yourOracleServer:1521/yourOracleDatabaseServiceName/Dedicated? PollingId=MyPollingNotification1

对于上述连接 Uri,将为 Oracle 数据库适配器Oracle Database adapter POLLINGSTMT 操作创建以下命名空间。For the above connection URIs, the Oracle 数据库适配器Oracle Database adapter creates the following namespace for the POLLINGSTMT operation.

http://Microsoft.LobServices.OracleDB/2007/03/POLLINGSTMTMyPollingNotification1

有关在以下情况中如何建立与 Oracle 数据库的连接的信息:For information about how to establish a connection to the Oracle database when you:

使用 使用 Adapter Service BizTalk 项目加载项Consume Adapter Service BizTalk Project Add-in 或 添加适配器服务参考 Visual Studio 加载项Add Adapter Service Reference Visual Studio Plug-in ,请参阅 使用使用适配器服务连接到 Visual Studio 中的 Oracle Database。Use the 使用 Adapter Service BizTalk 项目加载项Consume Adapter Service BizTalk Project Add-in or the 添加适配器服务参考 Visual Studio 加载项Add Adapter Service Reference Visual Studio Plug-in, see Connect to Oracle Database in Visual Studio using the Consume Adapter Service.

在解决方案中配置发送端口或接收端口 (位置) BizTalk ServerBizTalk Server ,请参阅 手动配置到 Oracle Database 适配器的物理端口绑定。Configure a send port or receive port (location) in a BizTalk ServerBizTalk Server solution, see Manually configure a physical port binding to the Oracle Database Adapter.

在编程解决方案中使用 WCF 通道模型,请参阅 使用 Oracle Database 创建通道。Use the WCF channel model in a programming solution, see Create a channel using Oracle Database.

Use the WCF service model in a programming solution, see Configure a client binding for the Oracle Database.

另请参阅See Also

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值