background image
<< Running SQL*Plus in a Command Window | Database Connection from SQL Developer >>
<< Running SQL*Plus in a Command Window | Database Connection from SQL Developer >>

Connecting to the Database

Overview of Application Development with Oracle Database
Overview of Oracle Database and Development 1-7
Connecting to the Database
Remember that in Oracle Database, the user and the name of the schema to which the
user connects are the same. This section shows how to create a connection to the
hr
schema, one of the sample schemas that ship with Oracle Database. To begin, you
must unlock the
hr
account.
This section contains the following topics:
Unlocking a User Account
Connecting to Oracle Database from SQL*Plus
Connecting to Oracle Database from SQL Developer
Unlocking a User Account
By default, when the
hr
schema is installed, it is locked and its password is expired.
Before you can connect to Oracle Database using the
hr
schema, a user with
administrator privileges needs to unlock the
hr
account and reset its password.
The following steps show how to unlock the
hr
account and change its password.
To unlock the hr account and change its password:
1.
Start a new SQL* Plus session, and login as a user with administrative privileges,
such as user
SYSTEM
. See
"Introducing SQL*Plus"
on page 1-5.
2.
At the SQL prompt, enter the following statement:
Remember to choose a password that is secure. See Oracle Database Security Guide
for guidelines on choosing passwords.
SQL> ALTER USER hr ACCOUNT UNLOCK IDENTIFIED BY
password
;
The system confirms that the
hr
account is unlocked and its password changed:
User altered
Connecting to Oracle Database from SQL*Plus
When the
hr
account is unlocked, you can create a new hr connection using the new
password that you set in
"Unlocking a User Account"
on page 1-7.
To create an HR Connection in SQL*Plus:
1.
Close the current connection to Oracle database. See step 6 of
"Introducing
SQL*Plus"
on page 1-5.
2.
Start SQL*Plus. In the
cmd.exe
window, at the
c:>\
prompt, enter
sqlplus
and
press the Enter button of your keyboard.
3.
At the SQL prompt, enter
hr
, and then the password.
The system connects you to a database instance through the
hr
schema.
You can close both the connection and the command window.
Connecting to Oracle Database from SQL Developer
When the
hr
account is unlocked, you can use it to access the
hr
schema inside the
Oracle Database. In this section, you will be working with Oracle SQL Developer.
See Also:
SQL*Plus User's Guide and Reference