Vikas Manoria IT Specialist – IBM Academic Initiative [email_address] Section - 4) Databases
Section 4 - Databases (5%)
Create a database connection
Use the SQL Statement wizard
Sample contents of a database table
Purpose and Scope of the Database Tools
Used by Web Developers and EJB Developers
HTML form design
Map EJBs to databases
The Data Perspective provides functionality to
Connect to a database
Optionally filter tables by pattern
Import existing schema to local system
XMI files describe the database, schema, and objects contained in the DB
Only the schema definition is imported, NOT the data
Create new databases, schemas, tables, views, stored procedures, or user-defined functions
Features of the Data Perspective Tools
The built-in Derby database allows one client connection.
There is no extra installation required to use this database.
They provide the ability to create new databases and database objects using Class diagram, Information Engineering (IE) diagram, and Integration Definition for Function Modeling (IDEF1X) diagram logical modeling diagrams.
You can import and use existing database models.
You can also generate XML schemas from existing database models.
The tools allow you to build and execute SQL queries interactively from an imported database model, or through an active connection, using the SQL Editor and SQL Query Builder.
Use this perspective to work with databases, database objects and SQL statements
The Data Perspective views are:
Data Project Explorer
This module will examine each of these to see its use
Database Explorer View: Connecting to a Database
Right-click in the view and choose New Connection
Give the connection a name
Enter the details for the database
2 3 1
Data Project Explorer View
You can work locally with data objects.
This view allows you to create two types of projects
Data design projects
Data development projects
Contents of the Project in the Data Project Explorer
The project contains structure
No data is copied to the project
The Connection contains structure and a link back to the data
Data can be sampled from the Database Explorer view
Project Database Name Col.1 Col.2 Col.3 Col.4 REAL SCHEMA VARCHAR VARCHAR INTEGER Database Name Col.1 Col.2 Col.3 Col.4 REAL SCHEMA VARCHAR VARCHAR INTEGER Database Name Col.1 Col.2 Col.3 Col.4 123 A B 125 124 C REAL SCHEMA VARCHAR VARCHAR INTEGER
DB Output View
One of the principal uses of the Data Perspective is to verify values in the database
What is there before any code executes?
What was written after an SQL operation?
The DB Output view displays data from the connection created in the Database Explorer view
Creating SQL Statements
There are two ways to create an SQL statement in Rational Application Developer:
Is a standard text editor with Content Assist
Can edit multiple SQL statements
SQL Query Builder
Provides a visual editor
Can only edit one SQL statement
Both tools can be used to build an SQL statement.
SQL Query Builder generates most of the SQL you would have to type into the SQL Editor
Note that in the other perspectives, a SQL Scrapbook page:
Resembles the SQL Editor
Does not start with a SQL statement template
Is not stored as SQL
Cannot have host variables
Selecting How to Write the SQL Statement
Select File > New > Other > Data > SQL Statement .
Different Statement Templates are available
SELECT, INSERT, UPDATE, DELETE, FULLSELECT,WITH
Same as SQL builder
Plus: Sample Statements, None
Using the SQL Editor
In the New SQL Statement dialog
Name the statement(s)
You can have multiple statements in the editor
Choose the SQL editor
Choose a Statement Template
In the Connection Selection dialog that opens
Create a new connection
Reuse an existing connection
In the editor
Use Code Assist to build your
Use Database Connection
Right-click to Run SQL
Using the SQL Builder
You can open the SQL Builder by right-clicking the Statements folder and selecting New .
1 2 3
If there is no database available, what can you generate in Rational Application Developer?
What is the database installed with Rational Application Developer?
What is the restriction on this database?
Name the three views associated with the Data Perspective.
How do you visually modify an SQL statement?
Definitions for database, schema, table, view, stored procedure, or user-defined function.
Only one connection is allowed at a time.
Database Explorer, Data Project Explorer, DB Output
The SQL Builder allows you to visually describe an SQL statement.
Create DB Connection
View Table contents
Create DB Development Project
Work with SQL Statements
Japanese Hebrew Thank You English Merci French Russian Danke German Grazie Italian Gracias Spanish Obrigado Portuguese Arabic Simplified Chinese Traditional Chinese Thai Korean