4) databases

17
IBM RAD © 2008 IBM Corporation Vikas Manoria IT Specialist – IBM Academic Initiative [email protected] Section - 4) Databases

Upload: techbed

Post on 18-Nov-2014

704 views

Category:

Documents


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 4) databases

IBM RAD

© 2008 IBM Corporation

Vikas ManoriaIT Specialist – IBM Academic [email protected]

Section - 4) Databases

Page 2: 4) databases

IBM AI - RAD

Section 4 - Section 4 - Databases (5%)Databases (5%)

Create a database connection Create a database connection Use the SQL Statement wizard Use the SQL Statement wizard Sample contents of a database tableSample contents of a database table

Page 3: 4) databases

IBM AI - RAD

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

Page 4: 4) databases

IBM AI - RAD

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.

Page 5: 4) databases

IBM AI - RAD

Data Perspective

Use this perspective to work with databases, database objects and SQL statements

The Data Perspective views are:- Database Explorer- Data Output- Data Project Explorer- Model Report

This module will examine each of these to see its use

Page 6: 4) databases

IBM AI - RAD

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

Page 7: 4) databases

IBM AI - RAD

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

Page 8: 4) databases

IBM AI - RAD

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

ProjectDatabase Name

Col.1 Col.2 Col.3 Col.4

REAL

SCHEMA

VARCHARVARCHAR

INTE

GER

Database Name

Col.1 Col.2 Col.3 Col.4

REAL

SCHEMA

VARCHARVARCHAR

INTE

GER

Database Name

Col.1 Col.2 Col.3 Col.4

123 A B

125

124 C

REAL

SCHEMA

VARCHARVARCHAR

INTE

GER

Page 9: 4) databases

IBM AI - RAD

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

Page 10: 4) databases

IBM AI - RAD

Creating SQL StatementsThere are two ways to create an SQL statement in Rational Application Developer:- SQL Editor

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 EditorNote 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

Page 11: 4) databases

IBM AI - RAD

Selecting How to Write the SQL Statement

Select File > New > Other > Data > SQL Statement.

Choose - SQL builder- SQL editor

Different Statement Templates are available- SQL builder:

SELECT, INSERT, UPDATE, DELETE, FULLSELECT,WITH

- SQL editor Same as SQL builder Plus: Sample Statements, None

Page 12: 4) databases

IBM AI - RAD

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

SQL statement- Right-click to

Use Database Connection- Right-click to Run SQL

Page 13: 4) databases

IBM AI - RAD

Using the SQL Builder

You can open the SQL Builder by right-clicking the Statements folder and selecting New.

1

2

3

Page 14: 4) databases

IBM AI - RAD

Checkpoint

1.If there is no database available, what can you generate in Rational Application Developer?

2.What is the database installed with Rational Application Developer?

3.What is the restriction on this database?

4.Name the three views associated with the Data Perspective.

5.How do you visually modify an SQL statement?

Page 15: 4) databases

IBM AI - RAD

Checkpoint answers

1.Definitions for database, schema, table, view, stored procedure, or user-defined function.

2.Derby

3.Only one connection is allowed at a time.

4.Database Explorer, Data Project Explorer, DB Output

5.The SQL Builder allows you to visually describe an SQL statement.

Page 16: 4) databases

IBM AI - RAD

Lab

Create DB ConnectionView Table contentsCreate DB Development ProjectWork with SQL Statements

Page 17: 4) databases

IBM AI - RAD

Japanese

Hebrew

Thank You

English

MerciFrench

Russian

DankeGerman

GrazieItalian

GraciasSpanish

Obrigado Portuguese

Arabic

Simplified Chinese

Traditional Chinese

Thai

Korean