Database Reference
In-Depth Information
In order to put that role to work, we will categorize a certain set of the
appver
functions and
procedures as being for use only by
appver_admin
. We place those functions and procedures in a
package,
appsec_admin_pkg
, and grant execute on the package only to
appver_admin
. This command can
be run as either
SYS
or
appsec
user.
GRANT EXECUTE ON appsec.appsec_admin_pkg TO appver_admin;
We have one existing function,
f_set_decrypt_conns
that we will move from
appsec_public_pkg
to
this new package. No longer will just any application user be able to insert or update lists of connection
strings for an application. Only users with the
appver_admin
role will.
Delete Connection Strings
Deleting a connection string from the list is a task we accomplish in the local client application. We
simply formulate the key of the connection string value that we plan to remove, and then remove the
entry from
connsHash
. Use the
removeAppConnString()
method, shown in Listing 11-26.
Listing 11-26.
Remove Connection String from List, removeAppConnString()
private static void removeAppConnString()( String instance, String user ) {
instance = instance.trim();
user = user.trim();
String key = (instance + "/" + user).toUpperCase();
connsHash.remove( key );
}
In order to make the change permanent for all future users of the application, we need to save the
list to the Oracle Database. This is done by calling
putAppConnections(),
which we studied in Chapter
10 (see Listing 10-24).
Copy Connection Strings from Previous Version of Application
When the developer releases a new version of her application, she will want to use most of the same
connection strings as the old version. If she kept her inner class version number/name the same, then
she wouldn't need to worry about replicating connection strings; she would just continue using the
existing list. However, it may be that she will want a new version of her inner class, and hence a new list
of connection strings, for one of the following reasons:
•
To modify the list of connection strings for the new version.
•
To eventually disable the old version of her application by deleting the list of
connection strings associated with it.
If her application only used a single Oracle connection or possibly two, it would be no problem
rebuilding the list from scratch for the new version. However, if the application has many potential
connections from which it may draw data, then the ability to replicate connection strings from one
version of her application to the next will be a welcome feature.