|Oracle® Database Express Edition 2 Day Developer's Guide
11g Release 2 (11.2)
Part Number E18147-07
|PDF · Mobi · ePub|
You can connect to Oracle Database Express Edition (Oracle Database XE) only through a client program, such as SQL*Plus or SQL Developer.
This chapter contains the following sections:
SQL*Plus starts and prompts you for your user name.
SQL*Plus prompts you for your password.
Note:For security, your password is not visible on your screen.
The system connects you to an Oracle Database XE instance.
You are in the SQL*Plus environment. At the
SQL> prompt, you can enter and run SQL*Plus commands, SQL statements, PL/SQL statements, and operating system commands.
To exit SQL*Plus, type
exit and press the key Enter.
Note:Exiting SQL*Plus ends the SQL*Plus session, but does not shut down the Oracle Database XE instance.
Example 2-1 starts SQL*Plus, connects to Oracle Database XE, runs a SQL
SELECT statement, and exits SQL*Plus. User input is bold.
> sqlplus SQL*Plus: Release 18.104.22.168.0 Production on Thu Feb 17 09:48:30 2011 Copyright (c) 1982, 2010, Oracle. All rights reserved. Enter user-name: your_user_name Enter password: your_password Connected to: Oracle Database 11g Express Edition Release 22.214.171.124.0 - Beta SQL> select count(*) from employees; COUNT(*) ---------- 107 SQL> exit Disconnected from Oracle Database 11g Express Edition Release 126.96.36.199.0 - Beta >
"About SQL*Plus" for a brief description of SQL*Plus
SQL*Plus User's Guide and Reference for more information about starting SQL*Plus and connecting to Oracle Database XE
SQL Developer is a client program with which you can access Oracle Database XE. With Oracle Database XE 11g Release 2 (11.2), you must use SQL Developer version 3.0. This section assumes that SQL Developer is installed on your system, and shows how to start it and connect to Oracle Database XE. If SQL Developer is not installed on your system, see Oracle Database SQL Developer User's Guide for installation instructions.
Note:For the following procedure:
For instructions, see Oracle Database SQL Developer User's Guide.
If this is the first time you have started SQL Developer on your system, you are prompted to enter the full path to
exe (for example,
C:\jdk1.5.0\bin\java.exe). Either type the full path after the prompt or browse to it, and then press the key Enter.
The Oracle SQL Developer window opens.
In the navigation frame of the window, click Connections.
The Connections pane appears.
In the Connections pane, click the icon New Connection.
The New/Select Database Connection window opens.
For security, the password characters that you type appear as asterisks.
Near the Password field is the check box Save Password. By default, it is deselected. Oracle recommends accepting the default.
In the New/Select Database Connection window, click the tab Oracle.
The Oracle pane appears.
For Connection Type, accept the default (
For Role, accept the default.
In the fields Hostname and Port, either accept the defaults or type the appropriate values.
Select the option SID.
In the SID field, type accept the default (
In the New/Select Database Connection window, click the button Test.
The connection is tested. If the connection succeeds, the Status indicator changes from blank to
The New/Select Database Connection window closes. The Connections pane shows the connection whose name you entered in the Connection Name field in step 4.
You are in the SQL Developer environment.
To exit SQL Developer, select Exit from the File menu.
Note:Exiting SQL Developer ends the SQL Developer session, but does not shut down the Oracle Database XE instance. The next time you start SQL Developer, the connection you created using the preceding procedure still exists. SQL Developer prompts you for the password that you supplied in step 4 (unless you selected the check box Save Password).
"About SQL Developer" for a brief description of SQL Developer
Oracle Database SQL Developer User's Guide for more information about using SQL Developer to create connections to Oracle Database XE
To do the tutorials and examples in this document, and create the sample application, you must connect to Oracle Database XE as the user
HR from SQL Developer. The
HR sample schema is the development environment for the sample application.
Note:For the following procedure, you need the name and password of a user who has the
USERsystem privilege (for example,
Using SQL*Plus, connect to Oracle Database XE as a user with the
USER system privilege.
SQL> prompt, unlock the
HR account and reset its password:
Caution:Choose a secure password. For guidelines for securing passwords, see Oracle Database Security Guide.
ALTER USER HR ACCOUNT UNLOCK IDENTIFIED BY password;
The system responds:
HR account is unlocked and its password is
Now you can connect to Oracle Database XE as user
HR with the password
Oracle Database 2 Day + Security Guide for information about predefined user accounts provided by Oracle Database XE, including
Oracle Database SQL Developer User's Guide for information about accessing SQL*Plus within SQL Developer
Oracle Database Express Edition 2 Day DBA for information about using Enterprise Manager to unlock user accounts
Note:For this task, you need the password for the
If you are connected to Oracle Database XE, close your current connection.
You are now connected to Oracle Database XE as the user
See Also:SQL*Plus User's Guide and Reference for an example of using SQL*Plus to create an
Note:For the following procedure, you need the password for the
Follow the directions in "Connecting to Oracle Database XE from SQL Developer", entering the following values at steps 4:
For Connection Name, enter
(You can enter a different name, but the tutorials in this document assume that you named the connection
For Username, enter
For Password, enter the password for the
You are now connected to Oracle Database XE as the user