2 Day DBA > Connecting to the Database > About Local and Remote Conn... > About Remote Connections
About Remote Connections |
Previous |
Next |
Connecting remotely means running SQL Command Line (or any other Oracle command-line utility) on a computer other than the Oracle Database XE host computer, and then initiating a database connection from SQL Command Line (or other utility) over the network.
Oracle Client Software
The remote computer must have Oracle client software installed. It is through Oracle client software that Oracle command-line utilities (and your applications) connect to the database. Oracle Database XE accepts connections from all of the following types of Oracle client software:
Oracle Database Express Edition Client (Oracle Database XE Client)
When you install Oracle Database XE, Oracle Database XE Client is also installed on the same computer. You can install Oracle Database XE Client separately on remote computers. It is available at
Instant Client is available at
http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html
Oracle client software for Oracle Database Enterprise Edition or Standard Edition (all supported releases of Oracle Database 8, 8i, 9i, and 10g)
All Oracle client software includes Oracle Net, which is the Oracle network software that enables client applications on one computer to connect to databases on another computer over a network.
Connect Strings
To connect remotely, you must supply not just a user name and password, but a complete Oracle Net connect string. In addition to the database user name and password, a connect string includes a host name or host IP address, an optional TCP port number, and an optional database service name. These additional parameters are required to help Oracle Net find the right host computer and connect to Oracle Database XE. An Oracle Net connect string has the following format:
CONNECT username/password@[//]host[:port][/service_name]
where:
//
is optional
host
is the host name or IP address of the computer that is running Oracle Database XE
port
(optional) is the TCP port number on which the Oracle Net listener is listening. If not specified, the default port number 1521 is assumed.
service_name
(optional) is the name of the database service to which to connect. For Oracle Database XE, the service name is XE
. If service_name
is omitted, Oracle Database XE Client appends a request for the default database service, which is configured during installation as XE
.
Note: Only Oracle Database XE Client supports the notion of a default database service. If you connect remotely from any Oracle client software other than Oracle Database XE Client, you must include theXE service name.
|
For example, Figure: Remote Connection shows a user connecting remotely with SQL Command Line and entering a connect
command that includes a connect string that supplies: the user name hr
, the password hr
, and the host name dbhost.xyz.com
. This connect string connects to the default database service (XE
) on the default port (1521
).
Remote Connection Examples
In the following examples of SQL Command Line connect
commands, Oracle Database XE is running on the host computer mydbserver.mydomain.com
.
Example 1 This example initiates a remote connection from Oracle Database XE Client, using the default port number.
CONNECT system/mypassword@mydbserver.mydomain.com
Example 2 This example initiates a remote connection from Oracle Database XE Client, using a nondefault port number (1522):
CONNECT system/mypassword@mydbserver.mydomain.com:1522
Example 3 This example initiates a remote connection using the default port number, and includes the optional service name.
CONNECT system/mypassword@mydbserver.mydomain.com/XE
Environment Variables
Before making a remote connection from Linux, you must set environment variables. See "Setting Environment Variables" for more information.