Download Multi-database query

Document related concepts
no text concepts found
Transcript
DB-1: OpenEdge® SQL in a 10.1B multidatabase environment for ODBC and JDBC
Brian Werne
Sr. Engineering Manager,
OpenEdge SQL and
OpenEdge Management
Objectives
Answers for the following:
 What is multi-database query?
 What’s going on under the covers?
 How do I manage the configuration?
2
DB-1: 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
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Multi-Database Query - client
Allow the ability to join tables in multiple databases ( cross database join)
Join: customers from DB, Orders from SecondDB, Inventory from
ThirdDB
SQL
Client
DBNavigator - JDBC URL
Crystal Reports – ODBC DSN
Customers
Orders
DB
4
Second
DB
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
Inventory
Third
DB
© 2007 Progress Software Corporation
10.1B Multi-Database Query - server
Cross database join
SQL
Client
DBNavigator - JDBC URL
Crystal Reports – ODBC DSN
Host
Shmem
Shmem
Second
DB
Shmem
Third
DB
OpenEdge SQL
Server
DB
5
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Terminology
6

Fields/Columns ( CustNum, CustName)

Table
( Customer)
- collection of columns

Schema ( PUB, bwerne)
- collection of tables

Catalog (AuxCat1, mysports)
- Alias for database
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Multi-Database Query – Scope
Mysports
PUB schema
Customer
7
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
AuxCat1
PUB
bwerne
Inventory
© 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
8
DB-1: 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
9
DB-1: 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"
10
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Single Database
simple query
SQL
Client
DBNavigator
- JDBC URL
Crystal Reports – ODBC DSN
Host
Shmem
OpenEdge SQL
Server
DB
11
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Multi-Database Support
Define primary and auxiliary database
SQL
Client
DBNavigator - JDBC URL
Crystal Reports – ODBC DSN
Host
Shmem
Second
DB
Shmem
Third
DB
OpenEdge SQL
Server
DB
Primary
12
Shmem
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
Read
Only
Auxiliaries
© 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
13
DB-1: 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
14
DB-1: 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;
15
DB-1: 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 }
16
DB-1: 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
17
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Multi-Database : automatic connections
SQL
Client
DBNavigator
- JDBC URL
Crystal Reports – ODBC DSN
dbname[-mdbq:config]
Host
Shmem
Shmem
Second
DB
Shmem
Third
DB
OpenEdge SQL
Server
Properties
DB
[config]
Primary
18
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
Read
Only
Auxiliaries
© 2007 Progress Software Corporation
Automatic connections
 How does solution this work?
 What is a property file?
 What does the property file contain?
19
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Property file example
sports2000.oesql.properties
configuration
name
[sql-configuration]
configuration-names-list=config1
[configuration.config1]
database-id-list=Aux1, Aux2
[database.Aux1]
Full path to database
Name=SportsAux1
Catalog=AuxCat1
Location=c:\openedge\WRK\db\SportsAux1
[database.Aux2]
Name=SportsAux2
Catalog=AuxCat2
Location=c:\openedge\WRK\db\SportsAux2
20
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Multi-Database : automatic connections
SQL
Client
DBNavigator
- JDBC URL
Crystal Reports – ODBC DSN
dbname[-mdbq:config1]
Host
Shmem
Shmem
Second
DB
Shmem
Third
DB
OpenEdge SQL
Server
Properties
DB
[config1]
Primary
21
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
Read
Only
Auxiliaries
© 2007 Progress Software Corporation
Single connection : JDBC -DBNavigator
jdbc:datadirect:openedge://localhost:6748;databaseNa
me=sports2000
22
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Multi-DB configuration:JDBC -DBNavigator
jdbc:datadirect:openedge://localhost:6748;databaseNa
me=sports2000 [-mdbq:config1]
23
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
DBNavigator – MDBQ configuration
Auxiliary
databases
Primary
database
24
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
ODBC – single connection
25
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
ODBC – Multi-DB configuration
26
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Crystal – looks like this with MDBQ
Auxiliary databases
Primary database
27
DB-1: 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
28
DB-1: 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
29
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Connection types
OpenEdge SQL
Server
connection
30
OpenEdge SQL
Client connection
Primary
SQSV
REMC
Auxiliary
SQFA
SQFC
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Connections – using MDBQ
OpenEdge SQL Server
Main
Thread
SQSV
SQFA
Primary
DB
REMC
Client 1
Thread
SQFC
REMC
Client 2
Thread
31
Auxiliary
DB
SQFC
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Promon – Primary Database
Primary database connections
32
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Promon – Auxiliary Database
Auxiliary database connections
33
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
OpenEdge Management User Activity View
– Primary Database
Primary database connections
34
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
OpenEdge Management User Activity View
– Auxiliary Database
Auxiliary database connections
35
DB-1: 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
36
DB-1: 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
37
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Multi-Database Query Support
Read
Only
SQL
Client
dbname[-mdbq:config1]
Host
Shmem
Shmem
Second
DB
Shmem
Third
DB
OpenEdge SQL
Server
Properties
DB
[config1]
Primary
38
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
Auxiliaries
© 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
39
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Planning – startup


40
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
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Shutdown of Auxiliary database
OpenEdge SQL Server
Main
Thread
SQSV
SQFA
Primary
DB
REMC
Client 1
Thread
SQFC
REMC
Client 2
Thread
Auxiliary
DB
SQFC
Primary DB broker unaffected
41
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Shutdown of Auxiliary database
OpenEdge SQL Server
Main
Thread
SQSV
Primary
DB
Auxiliary
DB
Primary DB broker unaffected
42
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Shutdown of Primary database
OpenEdge SQL Server
Main
Thread
SQSV
SQFA
Primary
DB
REMC
Client 1
Thread
SQFC
REMC
Client 2
Thread
Auxiliary
DB
SQFC
Auxiliary DB broker unaffected
43
DB-1: 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
44
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Promon – Disconnect of SQFA
OpenEdge SQL Server
Main
Thread
SQSV
SQFA
Primary
DB
REMC
Client 1
Thread
SQFC
REMC
Client 2
Thread
Auxiliary
DB
SQFC
Primary and Auxiliary DB broker unaffected
45
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Promon – Disconnect of SQFA
OpenEdge SQL Server
Main
Thread
SQSV
Primary
DB
Auxiliary
DB
Primary and Auxiliary DB broker unaffected
46
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Promon – Disconnect of REMC or SQFC
OpenEdge SQL Server
Main
Thread
SQSV
SQFA
Primary
DB
REMC
Client 1
Thread
SQFC
REMC
Client 2
Thread
Auxiliary
DB
SQFC
Primary and Auxiliary DB broker unaffected
47
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Promon – Disconnect of REMC or SQFC
OpenEdge SQL Server
Main
Thread
SQSV
SQFA
Primary
DB
REMC
Client 1
Thread
SQFC
Auxiliary
DB
Primary and Auxiliary DB broker unaffected
48
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
In Summary
 Multi-database query
 Manage the configuration
 Under the covers
49
DB-1: 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
50
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Other Exchange Sessions
 DB-10: What’s New in OpenEdge 10.1B



51
RDBMS
DB-11: Moving to OpenEdge
COMP-10: OpenEdge Management and
Replication
DB-21: Data Management Roadmap and
Info Exchange
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Questions?
52
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Thank you for
your time
53
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
54
DB-1: OpenEdge SQL multi-database environment for ODBC and JDBC
© 2007 Progress Software Corporation
Related documents