Java Reference
In-Depth Information
Creating a datasource in JDeveloper
Next, we create a JDBC datasource in JDeveloper. We shall use the datasource in the
EJB 3.0 entity bean for database persistence. First, we need to create a database table
in some sample schema,
OE
for example. Run the following SQL script in SQL *Plus:
CREATE TABLE Catalog (id INTEGER PRIMARY KEY NOT NULL,
journal VARCHAR(100), publisher VARCHAR(100),
edition VARCHAR(100), title VARCHAR(100),
author VARCHAR(100));
A database table gets created in the
OE
sample schema. Next, we need to create a
JDBC connection in JDeveloper with Oracle database. Open the
Database
Navigator
or select the
Database
Navigator
tab if already open. Right-click on the
IDE
Connections
node and select
New Connection
. In the
Create
Database
Connection
window, specify a
Connection
Name
, select
Connection Type
as
Oracle (JDBC)
,
specify
Username
as
OE
, which is the schema in which the
Catalog
table is created,
and specify the
Password
for the
OE
schema. Select
Driver
as
thin
,
Host Name
as
localhost
,
SID
as
ORCL
(If the database is
XE
, then the
SID
is
XE
), and
JDBC Port
as
1521
. Click on the
Test Connection
button to test the connection. If the connection
gets established, click on
OK
:
Search WWH ::
Custom Search