X

Proactive insights, news and tips from Oracle WebLogic Server Support. Learn Oracle from Oracle.

  • October 28, 2015

Data Source System Property Enhancement in WLS 12.2.1

Stephen Felts
Manager

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 shutdown In 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. If a 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.

See the  Blog announcing Oracle WebLogic Server 12.2.1 for more details on Multenacy and other new features.

Join the discussion

Comments ( 2 )
  • Adrian Friday, April 8, 2016

    Hi Steve,

    Useful information, thanks. Unfortunately we are using a different database, where the driver does not offer any suitable property equivalent to v$session to set such information. However, we can already set such information through init SQL on the data source, along the lines of:

    SQL set session with description = 'JDBC from X datasource in Y domain'

    But as far as we can tell this only allows use to set static infomation, whereas what we would like to do is something like:

    SQL set session with description = 'JDBC from X datasource in Y domain, server is ${weblogic.Name}'

    to identify the specific WL server (in a large cluster) connections to the DB are from.

    Am I correct in understanding there is no way to do this currently, and if so any chance of a future enhancement to allow it? Thanks!

    Regards,

    Adrian


  • Steve Felts Monday, April 18, 2016

    For system properties, we recognize the following variables and expand them.

    "${pid}"

    "${machine}"

    "${user.name}"

    "${os.name}"

    "${datasourcename}"

    "${partition}"

    "${servername}"

    "${domainname}"

    "${serverport}"

    "${serversslport}"

    You would need InitSQL to have the same expansion. It's not difficult to implement. I don't expect that any existing SQL statement would have any of these values but we could use a new prefix to indicate that we want expansion to guarantee upward compatibility.

    You could enter an enhancement request.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.