It will use what is known as a
connected user database link: the remote database authenticates the connection request using
the user??™s credentials on the server where the user executes the query. The previous examples
were fixed user connections??”the same credentials are used to authenticate the connection
request regardless of the user making the request. Here is an example of using the connected
user database link; not surprisingly, it looks identical to using a fixed user database link:
select * from EMPLOYEES@HR_LINK;
When the user references this link, the database will attempt to resolve the global object
name in the following order:
1. It will search the local tnsnames.ora file to determine the proper host name, port, and
instance name or service name.
2. It will check the database link for a connect to specification. If the connect to current_
user clause is found, it will attempt to connect to the specified database using the connected
user??™s username and password.
3. It will search the from clause of the query for the object name.
Connected user links are often used to access tables whose rows can be restricted according
to the username that is accessing the tables. For example, if the remote database had a table
named HR.EMPLOYEES, and every employee were allowed to see their own row in the table,
then a database link with a specific connection, such as
create public database link HR_LINK
connect to HR identified by employeeservices202
using 'hq';
would log in as the HR account (the owner of the table).
Pages:
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889