tool username/password@service_name
In this syntax:
tool | Specifies the command used to invoke a tool such as SQL*Plus, SQL*Forms, etc. |
username | Specifies an Oracle username on the server. |
password | Specifies the corresponding password on the server. |
service_name | Specifies a service name entered in the TNSNAMES.ORA file that identifies the connect descriptor for the desired server. If the server is in the client's default domain, the service name does not need to include the domain name. However, if the server is in another domain, the service name must include the domain. (The default domain is determined by a parameter in the client's SQLNET.ORA file. See the section on the SQLNET.ORA file in Appendix A of this manual.) |
For example, in a network with only one domain, the default .WORLD domain, it is not necessary to include .WORLD in the service name. For example: | |
% sqlplus scott/tiger@SERVERX
However, if the client's default domain were .EAST and the server's domain were .WEST, then the service name would have to include the domain. For example, |
% sqlplus scott/tiger@SERVERX.WEST
Most Oracle tools can use the operating system command line to connect; some provide alternatives.
Figure 5 - 1. Connection from Logon Screen
EXEC SQL CONNECT :username IDENTIFIED BY :password
In this connection request, the :username and :password are 3GL variables that can be set within the program either statically or by prompting the user. When connecting to a database server, the value of the :username variable is in the form:
username@service_name
which is the same as in the tool logon screen above. The :password variable contains the password for the database account being connected to.
SQL> CONNECT username/password@service_name
For example:
SQL> CONNECT SCOTT/TIGER@SERVERX
This is very similar to the operating system command line method, except that it is entered in response to the tool prompt instead of the operating system prompt.
Other Oracle tools use slightly different methods specific to their function or interface. For example, Oracle CDE tools use logon buttons and a pop-up window with the username, password, and remote database ID field. For more information on connecting to Oracle with a specific tool, refer to the tool's user guide.