Anda di halaman 1dari 54

OpenEdge® SQL in a 10.

1B multi-database
environment for ODBC and JDBC

Doug Merrett
Senior Solution Engineer – EMEA
Progress Software
Objectives

Answers for the following:

 What is multi-database query?

 What’s going on under the covers?

 How do I manage the configuration?

OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Agenda

 Overview of multi-database configurations

 Connections and how they show up

 Data access – single and multi-database

 Management and planning

OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Multi-Database Query – Done on Client

Allow the ability to join tables in multiple databases (cross database join)

Join: customers from DB, Orders from SecondDB, Inventory from ThirdDB

SQL DBNavigator – JDBC URL


Client Crystal Reports – ODBC DSN

Customers
Orders Inventory

DB Second Third
DB DB

OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
10.1B Multi-Database Query – Done on Server

Cross database join


SQL DBNavigator – JDBC URL
Client Crystal Reports – ODBC DSN

Host
Second
Shmem DB

Shmem OpenEdge SQL


Server
Third
Shmem
DB

DB

OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Terminology

 Fields/Columns (CustNum, CustName)

 Table (Customer)
- collection of columns

 Schema (PUB, dmerrett)


- collection of tables

 Catalog (AuxCat1, mysports)


- Alias for database

OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Multi-Database Query – Scope

Mysports AuxCat1

PUB schema PUB dmerrett

Inventory
Customer

OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
3 part naming – single database connection
Three level naming (already have this)

 Three level naming convention


schema.table.column-name

 Example
SELECT Pub.Customer.CustNum,
Pub.Customer.Name,
Pub.Order.OrderNum ...

 Applies to schema, tables, columns, stored


procedures

OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
4 part naming – multi-database query
Four level naming

 Four level naming convention


catalog.schema.table.column-name

 Example
SELECT Pub.Customer.CustNum,
SportsPrimary.Pub.Customer.Name,
SportsAux1.Pub.Order.OrderNum ...

 Applies to schema, tables, columns, stored


procedures

OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Crystal Reports – cross database join

Catalog
SELECT "Customer1"."CustNum",
"Customer1"."Name", "Order1"."OrderDate",
"Order1"."Ordernum", "OrderLine1"."Itemnum",
"OrderLine1"."Qty", "OrderLine1"."OrderLineStatus"
FROM ("AuxCat2"."PUB"."OrderLine" "OrderLine1"
INNER JOIN "AuxCat1"."PUB"."Order" "Order1" ON
"OrderLine1"."Ordernum"="Order1"."Ordernum")
INNER JOIN "SPORTS2000"."PUB"."Customer"
"Customer1" ON
"Order1"."CustNum"="Customer1"."CustNum"
ORDER BY "Customer1"."CustNum"

0 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Single Database
Simple query

SQL DBNavigator – JDBC URL


Client Crystal Reports – ODBC DSN

Host

Shmem OpenEdge SQL


Server

DB

1 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Multi-Database Support
Define primary and auxiliary database

SQL DBNavigator – JDBC URL


Client Crystal Reports – ODBC DSN

Host
Shmem Second
DB
Shmem OpenEdge SQL
Server
Shmem Third
DB

DB
Read
Primary Only Auxiliaries
2 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Agenda

 Overview of multi-database configurations

 Connections and how they show up

 Data access – single and multi-database

 Management and planning

3 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Multi-database connections

Two methods:

 Explicit connections to auxiliary databases


with CONNECT sql statement

 “Automatic” connection model

4 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Connecting to an Auxiliary Database

 Catalog – an alias for a database

 Connecting to an auxiliary database


CONNECT ‘/usr/wrk/sports2000’ AS CATALOG mysports;

• Must be on same host as Primary database

 Disconnecting a catalog
DISCONNECT CATALOG mysports;

5 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Auxiliary Database Details
Syntax

 Default catalog is the Primary database


SET CATALOG mysports;

 Listing available, currently connected


catalogs
SHOW CATALOGS
ALL | { PRO_NAME | PRO_TYPE | PRO_STATUS }

6 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Say What ?!?!

 Some applications, like Crystal Reports, only


allow you to issue SELECT statements

 Can’t use the CONNECT statement:


Now what?

 Use automatic connections


7 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Multi-Database : automatic connections

SQL DBNavigator – JDBC URL


Client Crystal Reports – ODBC DSN

dbname[-mdbq:config]

Host
Shmem Second
DB
Shmem
OpenEdge SQL
Server
Shmem Third
DB
Properties
DB [config] Read
Primary Only Auxiliaries
8 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Automatic connections

 How does solution this work?


 What is a property file?
 What does the property file contain?

9 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Property file example
sports2000.oesql.properties configuration
[sql-configuration] name
configuration-names-list=config1
[configuration.config1]
database-id-list=Aux1, Aux2
[database.Aux1]
Name=SportsAux1 Full path to database
Catalog=AuxCat1
Location=c:\openedge\WRK\db\SportsAux1
[database.Aux2]
Name=SportsAux2
Catalog=AuxCat2
Location=c:\openedge\WRK\db\SportsAux2

0 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Multi-Database : automatic connections

SQL DBNavigator – JDBC URL


Client Crystal Reports – ODBC DSN

dbname[-mdbq:config1]

Host
Shmem Second
DB
Shmem OpenEdge SQL
Server
Shmem Third
DB
Properties
DB [config1] Read
Primary Only Auxiliaries
1 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Single DB connection : JDBC – DBNavigator

jdbc:datadirect:openedge://localhost:6748;databaseName=sports2000

2 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Multi DB connection : JDBC – DBNavigator

jdbc:datadirect:openedge://localhost:6748;databaseName=sports2000 [-mdbq:config1]

3 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
DBNavigator – MDBQ configuration

Auxiliary
databases

Primary
database

4 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
ODBC – Single DB configuration

5 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
ODBC – Multi DB configuration

6 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Crystal – looks like this with MDBQ

Auxiliary databases

Primary database

7 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Every good engineering project has acronyms
(EGEPHA)

Primary or single database connections


 SQSV (OpenEdge SQL Server)
• Main OpenEdge SQL server process
connection to storage engine
 REMC (Remote Client)
• OpenEdge SQL client thread for each
connection to the primary database

8 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Under the covers - acronyms

Auxiliary connections
 SQFA (SQL Federated Agent)
• Main OpenEdge SQL connection to the
Auxiliary database
 SQFC (SQL Federated Client)
• OpenEdge SQL client thread for each
connection to the auxiliary database

9 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Connection types

OpenEdge SQL OpenEdge SQL


Server Client connection
connection
Primary SQSV REMC

Auxiliary SQFA SQFC

0 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Connections – using MDBQ
OpenEdge SQL Server

Main SQSV
Thread Primary
SQFA DB

REMC
Client 1
Thread SQFC

Auxiliary
REMC DB
Client 2
Thread SQFC

1 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Promon – Primary Database

Primary database connections

2 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Promon – Auxiliary Database

Auxiliary database connections

3 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
OpenEdge Management User Activity View
– Primary Database
Primary database connections

4 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
OpenEdge Management User Activity View
– Auxiliary Database
Auxiliary database connections

5 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
MDBQ Tips/Restrictions/Gotchas!!

 Restriction
• Primary and auxiliary databases must reside
on same host
 Connection authentication
• User credentials must be same on Primary
and each Auxiliary
 Database codepage
• Codepage of databases must be the same

6 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
MDBQ Tips/Restrictions/Gotchas!!

 Auxiliary connections are READ ONLY


• No update operations, schema or record based,
can be performed in the auxiliary databases.
Only the primary database will accept update
statements.
 Granting / revoking permissions – authorization
• Must be done on auxiliary database independently
 Performance considerations
• Update Statistics must be done on each auxiliary
database independently

7 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Multi-Database Query Support
Read
SQL Only
Client

dbname[-mdbq:config1]

Host
Shmem Second
DB
OpenEdge SQL
Shmem Server

Shmem Third
DB
Properties
DB [config1]

Primary Auxiliaries

8 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Agenda

 Overview of multi-database configurations

 Connections and how they show up

 Data access – single and multi-database

 Management and planning

9 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Planning – startup
 Effect of MDBQ: Primary DB startup parameters
• Effectively no change from single connection,
make use of –Mi to control number of
connections/threads per server. Still have SQSV
(server slot (-Mi,Ma)) and REMC (user slot (-n))
• Reminder: OpenEdge SQL does better with
threads (more connections per server)
 Effect of MDBQ: Auxiliary DB startup parameters
• SQFA is self-service (add one to –n)
• Each SQFC takes up a user slot (each add to –n)
• SQFA, for each SQSV, will host multiple SQFC
contexts

0 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Shutdown of Auxiliary database
OpenEdge SQL Server

Main SQSV
Thread Primary
SQFA DB

REMC
Client 1
Thread SQFC

Auxiliary
REMC DB
Client 2
Thread SQFC

Primary DB broker unaffected


1 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Shutdown of Auxiliary database
OpenEdge SQL Server

Main SQSV
Thread Primary
DB

Auxiliary
DB

Primary DB broker unaffected


2 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Shutdown of Primary database
OpenEdge SQL Server

Main SQSV
Thread Primary
SQFA DB

REMC
Client 1
Thread SQFC

Auxiliary
REMC DB
Client 2
Thread SQFC

Auxiliary DB broker unaffected


3 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Shutdown of Primary database

Primary
DB

Auxiliary
DB

Auxiliary DB broker unaffected


4 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Promon – Disconnect of SQFA
OpenEdge SQL Server

Main SQSV
Thread Primary
SQFA DB

REMC
Client 1
Thread SQFC

Auxiliary
REMC DB
Client 2
Thread SQFC

Primary and Auxiliary DB broker unaffected


5 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Promon – Disconnect of SQFA
OpenEdge SQL Server

Main SQSV
Thread Primary
DB

Auxiliary
DB

Primary and Auxiliary DB broker unaffected


6 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Promon – Disconnect of REMC or SQFC
OpenEdge SQL Server

Main SQSV
Thread Primary
SQFA DB

REMC
Client 1
Thread SQFC

Auxiliary
REMC DB
Client 2
Thread SQFC

Primary and Auxiliary DB broker unaffected


7 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Promon – Disconnect of REMC or SQFC
OpenEdge SQL Server

Main SQSV
Thread Primary
SQFA DB

REMC
Client 1
Thread SQFC

Auxiliary
DB

Primary and Auxiliary DB broker unaffected


8 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
In Summary

 Multi-database query

 Manage the configuration

 Under the covers

9 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
For More Information, go to…

 PSDN

 Progress eLearning Community


• Using OpenEdge SQL

 Documentation – 10.1B
• OpenEdge Data Management:
SQL Development
• OpenEdge Data Management:
SQL Reference

0 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Relevant Exchange 2007 Sessions

 DB-10: What’s New in OpenEdge 10.1B


RDBMS
 DB-11: Moving to OpenEdge
 COMP-10: OpenEdge Management and
Replication
 DB-21: Data Management Roadmap and
Info Exchange

1 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Questions?

2 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
Thank you for
your time

3 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation
4 OpenEdge SQL multi-database environment for ODBC and JDBC © 2007 Progress Software Corporation

Anda mungkin juga menyukai