Forum Discussion
Kris__109062
Sep 09, 2013Nimbostratus
Replace SID to SERVICE_NAME in Oracle connnection string
Hi,
I am trying to replace SID with SERVICE_NAME in an Oracle connection string using an irule on an F5 Oracle VS. I have used as a starting point the irule documented here - https://devcentral.f5....
Kevin_Stewart
Sep 09, 2013Employee
I didn't test this against an Oracle environment, but the following should get you closer:
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
set sid_match 0
if { [TCP::payload] contains "CONNECT_DATA=" } {
set sid_match 1
log local0. "original payload = [TCP::payload]"
set service_name "SERVICE_NAME=MYSERVICENAME"
if { [regsub -all -nocase "SID=MYSID" [TCP::payload] "$service_name" newdata] } {
TCP::payload replace 0 [TCP::payload length] ""
TCP::payload replace 0 0 $newdata
log local0. "replaced payload = $newdata"
}
}
TCP::release
TCP::collect
}
You'll need to re-add your pool logic, but you shouldn't have to do any of the payload length manipulation. Output from test using an HTTP POST:
original payload = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.11.110.10)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SID=MYSID)(CID=(PROGRAM=sqlplus)(HOST=xxxxxxx)(USER=xxxxxx))))
replaced payload = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.11.110.10)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MYSERVICENAME)(CID=(PROGRAM=sqlplus)(HOST=xxxxxxx)(USER=xxxxxx))))
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects