External Database Access (EDA) Version 11.2.3 April 2014 UNV-1123-EDA-1 Notices
Total Page:16
File Type:pdf, Size:1020Kb
Rocket UniVerse External Database Access (EDA) Version 11.2.3 April 2014 UNV-1123-EDA-1 Notices Edition Publication date: April 2014 Book number: UNV-1123-EDA-1 Product version: Rocket UniVerse V11.2.3 Copyright © Rocket Software, Inc. or its affiliates 1985-2014. All Rights Reserved. Trademarks Rocket is a registered trademark of Rocket Software, Inc. For a list of Rocket registered trademarks go to: www.rocketsoftware.com/about/legal. All other products or services mentioned in this document may be covered by the trademarks, service marks, or product names of their respective owners. Examples This information might contain examples of data and reports. The examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental. License agreement This software and the associated documentation are proprietary and confidential to Rocket Software, Inc., are furnished under license, and may be used and copied only in accordance with the terms of such license. Note: This product may contain encryption technology. Many countries prohibit or restrict the use, import, or export of encryption technologies, and current use, import, and export regulations should be followed when exporting this product. Contact information Website: www.rocketsoftware.com Rocket Software, Inc. Headquarters 77 4th Avenue, Suite 100 Waltham, MA 02451-1468 USA Tel: +1 781 577 4321 Fax: +1 617 630 7100 2 Contacting Global Technical Support If you have current support and maintenance agreements with Rocket Software, you can access the Rocket Customer Portal to report and track a problem, to submit an enhancement request or question, or to find answers in the U2 Knowledgebase. The Rocket Customer Portal is the primary method of obtaining support. To log in to the Rocket Customer Portal, go to: www.rocketsoftware.com/support If you do not already have a Rocket Customer Portal account, you can request one by clicking Need an account? on the Rocket Customer Portal login page. Alternatively, you can contact Global Technical Support by email or by telephone: Email: [email protected] Telephone: North America +1 800 729 3553 United Kingdom/France +44 (0) 800 773 771 or +44 (0) 20 8867 3691 Europe/Africa +44 (0) 20 8867 3692 Australia +1 800 707 703 or +61 (0) 29412 5450 New Zealand +0800 505 515 3 Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta Table of Contents Table of Contents Chapter 1 Chapter 1: External Database Access (EDA) External Database Access . 1-2 First normal form (1NF) vs. non-first normal form. 1-3 Table concepts. 1-4 Representing multivalues . 1-4 Associations . 1-5 I-descriptors. 1-5 Mapping example . 1-7 Chapter 2 Chapter 2: The EDA Schema Manager The EDA Schema Manager steps. 2-2 The EDA Schema Manager. 2-3 Create a new UniVerse server connection. 2-4 Connect to UniVerse server . 2-8 Managing connections . 2-11 About data sources . 2-11 Defining a data source . 2-14 Selecting EDA schema files . 2-19 Selectively mapping attributes . 2-21 View EDA server details . 2-27 View UniVerse server details . 2-28 View options . 2-29 Verifying the EDA schema . 2-44 Viewing the EDA schema . 2-47 Viewing the DDL scripts . 2-48 Converting data. 2-49 Viewing EDA files. 2-51 Listing and selecting data . 2-52 Listing data using RetrieVe. 2-52 Listing data using UniVerse SQL. 2-53 C:\Users\awaite\Documents\U2Doc\UniVerse\11.2\Source\EDA\EDATOC.fm (bookTOC.template) March 17, 2014 11:34 am Chapter 3 Chapter 3: External database drivers supplied with EDA EDA Oracle driver . 3-2 Set up the EDA environment. 3-2 Set up the Oracle connection file . 3-2 Set up dynamic-loading library . 3-3 Create ORACLEPATH Environment Variable . 3-3 Create the EDA data source . 3-3 Oracle data type mapping . 3-4 EDA DB2 driver. 3-5 Set up the EDA environment. 3-5 Install DB2 or the DB2 client . 3-5 Set up connection to the DB2 database . 3-5 Create the EDA data source . 3-6 DB2 data type mapping . 3-6 EDA SQL Server driver . 3-7 Install SQL Server and create ODBC data source . 3-7 Create the EDA data source . 3-7 Set up the EDA configuration file . 3-7 SQL Server data types . 3-8 EDA SQL Server driver for UNIX and Linux . 3-9 Set up the EDA environment. 3-9 Install unixODBC and third-party ODBC driver . 3-9 Set up connection to external database . 3-10 Set up the ODBC dynamic loading library path . 3-10 Create the EDA data source . 3-11 Automatic data type mapping . 3-11 Chapter 4 Chapter 4: External Database Access Driver API External Database Access Driver API . 4-2 Registering an EDA driver . 4-3 EDA Driver functions. 4-4 EDADRV_LoadSymbols . 4-5 EDADRV_Connect . 4-8 EDADRV_Disconnect . 4-9 EDADRV_EndTransaction . 4-10 EDADRV_PrepareStmt. 4-11 EDADRV_ExecuteStmt. 4-13 EDADRV_CloseStmt . 4-15 EDADRV_DropStmt . 4-16 5 External Data Access (EDA) EDADRV_FetchStmt . 4-17 EDADRV_Perform . 4-19 EDADRV_GetEDAAttr . 4-21 EDADRV_GetErrmsg. 4-23 EDADRV_Cleanup . 4-24 EDADRV_FreeResult . 4-24 EDADRV_GetDBInfo. 4-25 EDADRV_GetSpecialInfo . 4-27 ECL Command . 4-30 EDA Driver log files. 4-31 The EDA Driver header file . 4-32 Chapter 5 Chapter 5: EDA ECL commands Connecting to the external database. 5-2 Disconnecting from the external database. 5-3 Converting UniVerse data to an external database . 5-3 VERIFY.EDAMAP . 5-4 LIST.EDAMAP . 5-5 SAVE.EDAMAP . 5-7 SELECT.EDA.NONCONFORMING . 5-8 Retrieving information about the EDA driver . 5-9 Chapter 6 Chapter 6: EDA exception handling Chapter 7 Chapter 7: EDA Replication EDA Replication . 7-2 Setting up a server. 7-3 Create a new UniVerse server connection . 7-4 Defining a data source . 7-8 Defining EDA replication parameters . 7-13 Chapter 8 Chapter 8: EDA best practices Map selected fields . 8-1 Avoid multiple multivalued associations . 8-1 Avoid restrictive data types . 8-1 RECORD_BLOB . 8-2 Updating an EDA tile from the external database. 8-3 Table of Contents 6 Chapter Chapter 1: External Database Access (EDA) 1 External Database Access . 1-2 First normal form (1NF) vs. non-first normal form. 1-3 Table concepts. 1-4 Representing multivalues . 1-4 Associations . 1-5 I-descriptors . 1-5 Mapping example . 1-7 C:\Users\awaite\Documents\U2Doc\UniVerse\11.2\Source\EDA\EDACH01TOC.fm March 17, 2014 11:34 am External Database Access External Database Access (EDA) enables you to convert data stored in the UniVerse database to a 1NF database, such as Microsoft SQLServer, then access that data using existing UniVerse BASIC programs, RetrieVe, or UniVerse SQL. Note: EDA was not designed to access data that already resides in a 1NF database. To access this type of data, use the UniVerse SQL Client Interface (BCI). You must create an EDA Map Schema to define the translation between UniVerse and the external database model, which may differ from the UniVerse model. Additionally, the UniVerse dictionary record does not fully describe the data it defines. For example, the UniVerse dictionary record may not define the data type. In order to use EDA, you must have the external database client installed on the machine where you are running UniVerse. In addition, you must be able to access the external database server where you want the data to reside using that client. 1-2 External Database Access (EDA) First normal form (1NF) vs. non-first normal form Many relational databases, including DB2, Oracle, and SQL Server, follow the First Normal Form (1NF) data model. In this model, the relation is considered to be 1NF if and only if each attribute of the relation is atomic, meaning that each column must contain only a single value, and each row must contain the same columns. UniVerse follows the nested relational, or Non-First Normal Form model, referred to as NF2. This model enables you to store data in singlevalued or multivalued attributes, avoiding data redundancy. First normal form (1NF) vs. non-first normal form 1-3 Table concepts This section is provided to help you understand how the EDA Schema Manager generates tables on an external database, such as DB2, Oracle, or SQL Server, so you can plan your mapping strategy. The EDA Schema Manager imposes rules on creating, modifying, and dropping tables. Representing multivalues To represent the two nested levels of data within UniVerse files or UniVerse SQL tables (singlevalued, and multivalued, the EDA Schema Manager creates two types of tables, one for each nested level: Singlevalued attributes (S) – a table that represents all singlevalued attributes. In this document this table is also called the primary table. For each association: Multivalued attributes (MV) – a table containing multivalued attri- butes of the association. These tables are “linked” through primary and foreign keys. Note: Each nonassociated multivalued attribute is mapped to a single external database table linked to the primary table through the primary and foreign keys. Primary and foreign keys The primary and foreign keys establish the same data relationship between tables as associations do in UniVerse files or UniVerse SQL tables. The purpose of a primary key is to specify one or more attributes whose data values uniquely identify each row of a table. The purpose of a foreign key is to represent a hierarchical, or parent/child, relationship between two tables. For example, a table containing multivalued attributes is the child of the primary table. The foreign key to this table points to the primary key of the parent, or primary, table.