In this section: |
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.
If you issue multiple SET CONNECTION_ATTRIBUTES commands:
The 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.
How to: |
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 commands. 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.
ENGINE [SQLORA] SET CONNECTION_ATTRIBUTES [connection_name]/userid,password
where:
Indicates the Adapter for Oracle. You can omit this value if you previously issued the SET SQLENGINE command.
Specifies a remote instance using an Oracle TNSNAME (the net service name used as a connect descriptor to an Oracle database server across the network). If omitted, the local database server will be set as the default.
Is the primary authorization ID by which you are known to Oracle, up to 30 characters in length.
Is the password associated with the user ID, up to 30 characters in length.
Note: SET USER is a synonym for SET CONNECTION_ATTRIBUTES, supported for compatibility with earlier releases of the 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 changed as of FOCUS 7.2.
Issue the following query command to list status information for all declared connections:
ENGINE 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.
ENGINE 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:
ENGINE SQLORA SET CONNECTION_ATTRIBUTES /USERA,PWDA
How to: |
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:
ENGINE [SQLORA] SET DEFAULT_CONNECTION [connection_name]
where:
Indicates the Adapter for Oracle. You can omit this value if you previously issued the SET SQLENGINE command.
Is the connection name specified in a previously issued SET CONNECTION_ATTRIBUTES command. If omitted, the local database server is set as the default. If this connection name has not been previously declared, a FOC1671 message is issued.
Note:
The following SET DEFAULT_CONNECTION command selects the Oracle database server named TNSNAMEB as the default Oracle database server.
ENGINE 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:
Is the user ID by default. It can consist of a maximum of 30 characters. Oracle prefers that the value be uppercase.
Is the name of the table or view. It can consist of a maximum of 30 characters.
Is the valid DATABASE LINK name defined in the currently connected Oracle database server.
Once you have met these 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 |