The SET CONNECTION_ATTRIBUTES command allows you to declare a connection to one Oracle database server and to supply authentication attributes necessary to connect to the server. You can declare connections to more than one Oracle database server by issuing multiple SET CONNECTION_ATTRIBUTES commands. The actual connection takes place when the first request referencing that connection is issued. You can issue SET CONNECTION_ATTRIBUTES commands in a FOCEXEC, at the FOCUS command prompt or in a FOCUS-supported profile. The profile can be encrypted. |
In this section: Connecting to an Oracle Database Server Authenticating a User on an Oracle Database Server Selecting an Oracle Connection to Access Oracle Support for DATABASE LINKs How to: Declare Connection Attributes for Oracle Query the Declared Oracle Connections Select an Oracle Connection to Access Example: |
If you issue multiple SET CONNECTION_ATTRIBUTES commands:
The data adapter supports connections to:
Once you are connected to an Oracle database server, that server may define Oracle DATABASE LINKs that can be used to access Oracle tables on other Oracle database servers.
Users can issue multiple SET CONNECTION_ATTRIBUTES commands to supply valid user IDs and passwords.
If needed, the DBA or some other authorized person at your site will supply you with a valid Oracle user ID and password.
It may be desirable to prompt users for their Oracle password instead of coding it in a procedure. In this case, use a Dialogue Manager variable in its place, and retrieve the value using -CRTFORM or -PROMPT facilities. If you use -CRTFORM, you can make the password field non-displayable for additional security.
A valid Oracle user ID and password must be supplied before issuing commands that access the Oracle RDBMS. If a valid Oracle login ID and password have not been supplied, an error message is returned. You should respond by correcting and re-issuing the SET CONNECTION_ATTRIBUTES command.
The SET CONNECTION_ATTRIBUTES command stores both the Oracle login ID and password in user virtual storage; it does not immediately initiate a login to Oracle. The actual login is deferred until a subsequent command is issued that requires the services of the Oracle RDBMS.
SQL [SQLORA] SET CONNECTION_ATTRIBUTES [connection_name]/userid,password
where:
Note: SET USER is a synonym for SET CONNECTION_ATTRIBUTES, supported for compatibility with earlier releases of the data adapter. However, note that the symbol used for separating the connection attribute from the authentication information and the symbol used for separating the user ID from the password have changed in FOCUS 7.2.
Issue the following query command to list status information for all declared connections:
SQL SQLORA ? SERVERS
Refer to the following diagram in conjunction with these examples:
The following SET CONNECTION_ATTRIBUTES command connects to the Oracle database server named TNSNAMEA with an explicit user ID and password:
SQL SQLORA SET CONNECTION_ATTRIBUTES TNSNAMEA/USERA,PWDA
The following SET CONNECTION_ATTRIBUTES command connects to a local Oracle database server with an explicit user ID and password:
SQL SQLORA SET CONNECTION_ATTRIBUTES /USERA,PWDA
Once all Oracle database servers to be accessed have been declared using the SET CONNECTION_ATTRIBUTES command, there are two ways to select a specific Oracle connection from the list of declared connections:
SQL [SQLORA] SET DEFAULT_CONNECTION [connection_name]
where:
Note:
The following SET DEFAULT_CONNECTION command selects the Oracle database server named TNSNAMEB as the default Oracle database server:
SQL SQLORA SET DEFAULT_CONNECTION TNSNAMEB
Note: You must have previously issued a SET CONNECTION_ATTRIBUTES command for TNSNAMEB.
You can be connected to one Oracle database server and access a table on another Oracle database server (without actually connecting to the second server) if the first server has a DATABASE LINK defined for the table.
To access a remote Oracle table using DATABASE LINKs, the following conditions must exist:
TABLENAME=[owner.]tablename@databaselink
where:
Once you have met the above conditions, all requests for the table will be processed on the remote Oracle database server specified using the DATABASE LINK name. Using this method is another way to access multiple remote servers in one SQL request.
Information Builders |