Data Source System Property Enhancement in WLS 12.2.1

来源:转载

The earlier blog at Setting V$SESSION for a WLS Datasource described using system properties to set driver connection properties, which in turn automatically set values on the Oracle database session.Some comments from readers indicated that there were some limitations to this mechanism.

- There are some values that can’t be set on the command line because they aren’t available until the application server starts.The most obvious value is the process identifier.

- Values set on the command line imply that they are valid for all environments in the server which is fine values like the program name but not appropriate for datasource-specific values or the new partition name that is available with the WLS Multi Tenancy feature.

- In a recent application that I was working with, it was desirable to connect to the server hosting the datasource that was connected to the session so that we could run a graceful shutdownIn this case, additional information was needed to generate the URL.

All of these cases are handled with the enhanced system properties feature.

The original feature supported setting driver properties using the value of system properties.The new feature is overloaded on top of the old feature to avoid introducing yet another set of driver properties in the graphical user interfaces and WLST scripts.It is enabled by specifying one or more of the supported variables listed in the table below into the string value.If one or more of these variables is included in the system property, it is substituted with the corresponding value. Ifa value for the variable is not found, no substitution is performed. If none of these variables are found in the system property, then the value is taken as a system property name.

Variable

Value Description

${pid}

First half (up to @) of ManagementFactory.getRuntimeMXBean().getName()

${machine}

Second half of ManagementFactory.getRuntimeMXBean().getName()

${user.name}

Java system property user.name

${os.name}

System property os.name

${datasourcename}

Data source name from the JDBC descriptor. It does not contain the partition name.

${partition}

Partition name or DOMAIN

${serverport}

WebLogic Server server listen port

${serversslport}

WebLogic Server server SSL listen port

${servername}

WebLogic Server server name

${domainname}

WebLogic Server domain name

A sample property is shown in the following example:

<properties>

<property>

<name>v$session.program</name>

<sys-prop-value>WebLogic ${servername} Partition ${partition}</sys-prop-value>

</property>

</properties>

In this example, v$session.program running on myserver is set to “WebLogic myserver Partition DOMAIN”.

The biggest limitation of this feature is the character limit on the associated columns in v$session.If you exceed the limit, connection creation will fail.

Using this enhancement combined with the Oracle v$session values can make this a powerful feature for tracking information about the source of the connections.



分享给朋友:
您可能感兴趣的文章:
随机阅读: