tool username/password@service_name
where:
tool | Specifies the command used to invoke a utility such as SQL*Plus, SQL*DBA, 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 Oracle Names or 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. |
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
Note: To prevent a password from displaying during a logon, you can omit the password parameter on the command line. You will then be prompted to enter your password. It will not be displayed as you enter it
Most Oracle utilities can use the operating-system command line to connect. Others provide alternatives.
Figure 3 - 6. 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 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 utility's prompt instead of the operating-system prompt.
Other Oracle utilities use slightly different methods specific to their function or interface. For example, Oracle CDE utilities 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 utility, see that utility's user guide.