Developer Tools
JDeveloper
You can easily create an application and project in which to organize your database files, and connect to a database and create a new user. Then work in JDeveloper's IDE to create an offline database, and reverse engineer it.
Create a New Application and Project: Use the Create Application wizard to create a new application and project for your database objects.
Create a Database Diagram: Use the Create Database dialog to create a new offline database diagram, and the Component Palette to add a table.
Create Database Tables on a Diagram: Use the Component Palette to add additional tables and a foreign key.
Create an Offline Database View: Use the Component Palette to add an offline database view to the diagram, and the Edit View dialog to specify properties.
Add a Sequence to a Diagram: Use the Edit Table dialog to add a new sequence, and then drag and drop onto the diagram.
Create a Table with Partitions: Begin from the Application Navigator and use the Create Table dialog to create a new table and add partitions.
Create a Database User and Database Connection: Use the Create Database Connection dialog to create a connection to the schema using a new user.
Generate a DDL Script: Use the Generate SQL from Database Objects wizard to generate a DDL script.
Reconcile the Database: Use the Edit Table dialog to add a new column, and then use the Generate SQL from Offline Database Objects wizard to generate another DDL script.
Reverse Engineer Database Objects: Use the Copy Database Objects to a Project wizard to copy the objects to a new project, and then drag and drop them onto a new diagram.
The JDeveloper application is the highest level in the organizational structure. It stores information about the objects you are working with, while you are creating your application. It keeps track of your projects and the environment settings while you are developing. [ tell me more...]
CreateDBObjects to follow along with the example.
oracle.
Application templates provide you with a quick way to create the project structure for standard applications with the appropriate combination of technologies already specified. The new application created from the template appears in the Application Navigator already partitioned into tiered projects, with the associated technology scopes set in each project. [ tell me more...]
NewSchema as the project name and click
Finish
.
In the Application Navigator, Projects panel, projects are displayed as the top level in the hierarchy. [ tell me more...]
To follow along with the example, in this step and throughout the cards, enter values as shown in the instructions. Then you will be able to follow the steps in the cue cards exactly as written. [ tell me more...]
DBOffline1 as the diagram name, and confirm that
oracle is entered as the package name. Then click
OK.
You have created a new database diagram. [ tell me more...]
DBOffline1 as the database name, and
DBDEMO as the default schema name. Then click
OK.
The Application Navigator displays the new offline database diagram and table. [ tell me more...]
You can use JDeveloper to work directly with database objects through a database connection. Alternatively, you can work with offline database definitions which you can subsequently generate to a database schema. [ tell me more...]
PERSONS. Then press Enter or Tab.
PERSON_ID:NUMBER(15,0) and press Tab.
FIRST_NAME:VARCHAR2(30 BYTE),
LAST_NAME:VARCHAR2(30 BYTE) and
GENDER:VARCHAR2(1 BYTE), one at a time pressing Tab to advance to the next.
When you see the default format exposed in the box, you can type over the default text. [ tell me more...]
ADDRESSES.
ADDRESS_ID,
ADDRESS_LINE1 and
ADDRESS_LINE2 to the
ADDRESSES table.
The Create Foreign Key dialog lets you edit the default foreign key properties. You can change the default name of the foreign key column or select another existing column as the foreign key column if you have already created it. [ tell me more...]
ADDRESSES_PERSONS_FK.
In the Application Navigator, the PERSONS and ADDRESSES tables are displayed in the Offline Database Sources node. [ tell me more...]
Views are virtual tables based on the result-set of a
SELECT statement that lets you combine tables and present the data as if the data were coming from a single table. You can add SQL Functions, Joins, WHERE, GROUP BY, ORDER BY, or HAVING clauses to a view, to present exactly the data you want to the user. [
tell me more...]
PERSON_INFO.
You can create a JOIN in the Edit View dialog; once the JOIN node is selected, the Edit button is available. [ tell me more...]
When you drag the selected table columns on the view, the cursor should change to indicate a valid target drop. [ tell me more...]
The database diagram now includes the offline database view: [ tell me more...]
A sequence is a schema object that can generate unique sequential values. These values are often used for primary and unique keys. One way to populate a key with a value from a sequence is to use a trigger to insert the sequence's
NEXTVAL into the field. [
tell me more...]
In the Edit Table dialog, selecting Populate Column from a Sequence on insert on a column creates a default sequence for that column, and an associated trigger. [ tell me more...]
The offline database diagram and Application Navigator display the new sequence and trigger you created. [ tell me more...]
If you have been following along with the example, the database objects created emulate an Oracle 11g database. If you have created objects that emulate another database type, for example an Oracle XE database, you may not be able to create partitions in a table. [ tell me more...]
ORDERS as the table name, and select
Ad
vanced
to display additional options. You should see a default column (
COLUMN1) populated in the
Columns
list.
ORDER_ID, then select
NUMBER from the
T
ype
dropdown list.
ORDER_DATE (type DATE),
ORDER_TOTAL (type NUMBER),
PERSON_ID (type NUMBER).
You can choose from any of the schemas that you have referenced in your project to create foreign keys between tables in different schemas. The
Associations column in the referenced table defaults to that table's primary key (in this example,
PERSON_ID). [
tell me more...]
ORDERS_PRE_2007 for the name and
TO_DATE('01/01/2007', 'MM/DD/YYYY') for the values.
ORDERS_2007 for the name and
TO_DATE('01/01/2008', 'MM/DD/YYYY') for the values. Then click
OK.
The Application Navigator displays the new ORDERS table that was created: [ tell me more...]
You can connect to any database for which you have connection details. If you can connect as a user with DBA privileges, follow the steps in this card to create an IDE database connection and then create a new database user with the name
DBDEMO. [
tell me more...]
DBDEMO. If you don't have DBA privileges, ask your DBA to create a
DBDEMO database user with the Roles and System privileges as specified in this card. Then proceed to step 16 in this card to create a DBDEMO connection.
When you create the IDE database connection, the Database Navigator should look similar to this, when you expand the IDE Connections node: [ tell me more...]
DBDEMO as the name for the new user, then enter a password.
DBDEMO user you added earlier.
DBDEMO as the connection name, and
DBDEMO for the user name. Then enter the password and connection details. (If your DBA created the
DBDEMO user, get the password and connection details from your DBA.)
When you create the DBDEMO database connection, the connection is now included as a resource for your application in the Application Resources panel of the Application Navigator. To see the DBDEMO connection you created, expand Connections | Database. [ tell me more...]
You can use JDeveloper to generate DDL for any offline objects you have created. You can choose the objects to include, whether you need
CREATE,
REPLACE or
ALTER keywords, and other options for the DDL. You can choose to generate the DDL straight into a specific database or to generate a
.sql script, using the Generate SQL from Database Objects wizard. [
tell me more...]
If you have been following along with the example, the database objects created emulate an Oracle 11g database, and you can shuttle all the offline database objects to the Selected list. [ tell me more...]
You can use the SQL Worksheet to enter and execute SQL, PL/SQL and SQL*Plus statements. You can specify any actions that can be processed by the database connection associated with the worksheet, such as creating a table, inserting data, creating and editing a trigger, selecting data from a table, and saving that data to a file. [ tell me more...]
Run Script and review the output displayed.
When you run the SQL script, the output displays in the Script Output page of the SQL Worksheet: [ tell me more...]
A powerful function of JDeveloper is the ability to compare offline database object definitions with live database objects. You can visually compare each change and choose to either generate that change to the database in the form of an
ALTER script, or live to the database. [
tell me more...]
TOWN and the size of type
VARCHAR2 to
25. Then click
OK.
3 way flag (M)ale (F)emale (D)eclined to answer. Then click
OK.
Using A LTER and Manual Reconcile allows you to review the differences between the offline object definition and the object definition in the database. You are then able to specify which of the differences should be included in the generated DDL. [ tell me more...]
After completing the wizard, the new script displays in the DBOffline1 node in the Application Navigator and is open in the SQL Worksheet source editor. [ tell me more...]
In many application development projects, the starting point is an existing database. JDeveloper gives you the ability to reverse engineer any existing objects in the database into your application. From there you can edit, delete and create new offline definitions prior to generating new SQL scripts. [ tell me more...]
DBRevEng as the project name and click
Finish
.
DBDemoReverse as the name and
DBDEMO as the default schema. Then click
OK.
The generated objects are displayed in the Application Navigator. [ tell me more...]
DBOffline2 as the diagram name, and confirm that
oracle is entered as the package name. Then click
OK.
The new database diagram shows the reverse-engineered objects, which were generated into the project and then dragged onto the diagram. [ tell me more...]
Copyright © 1997, 2009, Oracle. All rights reserved.