Databases Reference
In-Depth Information
Caution Make sure you always turn off the extra debugging once you've finished with it, particularly in
production, otherwise you risk giving away a great deal of useful information which could be used in an attack
against your system.
Configuring Virtual Hosts with the EPG
You saw earlier in the chapter how you could configure the OHS to configure virtual hosts and Apache
rewrites which allowed you to give your end users a more “friendly” URL to use. So, can you do that with
the EPG? Well, until fairly recently I didn't think it was possible at all. However, following a conversation
with my friend, Tim Hall, who runs the fantastic and highly informative Oracle Base website at
http://www.oracle-base.com , it turns out that you actually can achieve a similar result. I asked Tim if I
could show a technique here based on his examples and he agreed. (Thanks, Tim!) Note I say “similar
result” since it is not true virtual hosting, although it does let you do some quite cool things.
So, first, we need to create a new DAD entry.You could apply this technique to the existing APEX
DAD, but I prefer not to tinker with that and instead create my own custom DAD. This needs to be done
as a DBA-level user:
BEGIN
DBMS EPG.create dad (
dad name => 'training',
path => '/training/*');
END;
/
BEGIN
DBMS EPG.authorize dad (
dad name => 'training',
user => 'TRAINING');
END;
/
Here we create a new DAD called training, which will be referenced by /training/* in the URL.
Then we authorize the dad to link it to the TRAINING database user/schema.
The next step is to make use of a couple of DAD attributes called path-alias and path-alias-
procedure . The path-alias attribute allows us to add a new URL /training/rs (the “rs” does not refer to
anything in particular; I could have named it anything, or indeed used the root URL).
BEGIN
DBMS EPG.set dad attribute(
dad name => 'training',
attr name => 'path-alias',
attr value => 'rs');
DBMS EPG.set dad attribute(
dad name => 'training',
attr name => 'path-alias-procedure',
Search WWH ::




Custom Search