| � <<< Note 796.0 by TYFYS::MUNNS >>>
� -< Oracle synonyms, Rdb equivalent ? >-
� In the Oracle environment, synonyms can be defined for table names,
� so that table names are not hardcoded in applications. Is their
� an equivalent mechanism in the Rdb environment ?
Well, I don't know whether this is the reason for synonyms or not. I mean
why does it matter that the table names are hardcoded? Once applications are in
production, tablenames never change in my experience. One reason why ORACLE has
synonyms is that if user X defines a table TABLE1, and user Y wants to use it
then, after granting access to that table touser Y, user Y needs to refer to
the table as X.TABLE1, ie if he just says TABLE1, ORACLE will tell him the
table doesn't exist. Therefore you can define a synonym TABLE1 for user Y that
equates to X.TABLE1. Now he can refer to the table as TABLE1.
I guess if you really want to do it you could always define a view for each
table. Then if the underlying tablename changes, you just need to change the
view, not the programs.
John.
|
| The customer who mentioned that they make heavy use of synonyms does so
for 2 reasons:
1. Synonyms prevent the hardcoding of table names, they act as
logicals.
2. Synonyms are used to enforce security in Oracle systems.
Reply .1 answers to reason 2, does Rdb have a mechanism for reason 1 ?
|
| � <<< Note 796.2 by TYFYS::MUNNS >>>
� -< Synonyms as logicals >-
� 1. Synonyms prevent the hardcoding of table names, they act as
� logicals.
Well, the customer really hasn't answered the question :- "When would you
change a tablename in an application"? Typically, you select columns from
tables. What's the point of being able to change the table name when all the
columns are still the same? Does it really matter what the table is called?
Again, having said that, you can hide the table name with a view, and use the
view name in the application. If you must change the name of the table, then
just change the view definition in the database. The application remains the
same.
However, there is no direct equivalent to SYNONYMS in Rdb.
John.
|