JDBC with Complex URLs
In this example, the database URL is configured for high availability, so it is quite long and complex. Choosing theRun a regular expression on itURL option is the way to go. Disable the use of the Host and Port properties for JDBC automatic discovery. Instead enable the use of the URL that appears in the JDBC call, along with a regular expression to get the correct database naming and discovery.
For example, to extract all the hosts and all the ports from the following URL:
jdbc:oracle:thin:@(DESCRIPTION_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON)(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=titanpfmcl01)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=trafrefpfm01.global.trafigura.com)))(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=titanpfmcl02)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=trafrefpfm01.global.trafigura.com))))
This sample is for a string that contains the host and service name twice. You can also use port in your regular expression if needed by your requirements.
The following regular expression applied to the previous high availability URL results in a backend name similar to this: titanpfmcl01-trafrefpfm01.global.trafigura.com-titanpfmcl02-trafrefpfm01.global.trafigura.com.
.*HOST=([^\)]*).*SERVICE_NAME=([^\)]*).*HOST=([^\)]*).*SERVICE_NAME=([^\)]*).*
Summary | Rule Configuration |
---|---|
|