Title of Your Presentation
Download
Report
Transcript Title of Your Presentation
Maintain to RDBMS Interaction
Mark Rawls / Mark Derwin
June, 2008
Copyright 2007, Information Builders. Slide 1
Maintain to RDBMS Interaction
When maintaining relational databases, you may want
to interact with the database or environment on a more
native level. Maintain gives you the ability to issue
these commands, both to the environment and the
database, directly. Helping developers ensure the
most efficient interaction between Maintain and
RDBMS servers.
Today we will deal with three types of those
commands: Controlling the environment, Retrieving
RDBMS error codes, and issuing native commands to
the database.
Copyright 2007, Information Builders. Slide 2
SYS_MGR commands
Copyright 2007, Information Builders. Slide 3
SYS_MGR commands
When issuing SQL commands to the database, both error
and successful messages are displayed to the screen.
Maintain allows you to retrieve these error codes and
branch accordingly. The first thing to do is stop the
messages from being echoed to the screen. To accomplish
this from inside Maintain, issue a SYS_MGR command.
The syntax is:
SYS_MGR.FOCSET(“EMGSRV”, ”OFF”);
The FOCSET command is used to change the environment.
This command turns off EMGSRV so no messages are
echoed to the screen.
Copyright 2007, Information Builders. Slide 4
SYS_MGR commands
Now that the errors aren’t being displayed, we need to
retrieve them inside the Maintain application. We do
this with another SYS_MGR command:
SYS_MGR.DBMS_ERRORCODE;
Once you have this value, you can issue the proper
messages to guide your users.
Copyright 2007, Information Builders. Slide 5
SYS_MGR commands
Lastly, issuing commands directly to SQL. Some of the things
you can do with this command are Create and Drop Tables,
Set connection attributes, and Insert data into a Table. The
syntax for this command is:
SYS_MGR.ENGINE(“enginename”, “command”);
Copyright 2007, Information Builders. Slide 6
Example
Copyright 2007, Information Builders. Slide 7
Example
The example shown has a simple SQLMSS
database named Summit2008 containing three
fields: Field1, Field2, Field3. The form prompts the
user to enter values for these fields. Pressing
Include builds an SQL statement, and issues it to
the interface.
Copyright 2007, Information Builders. Slide 8
Example
Copyright 2007, Information Builders. Slide 9
Looking at the code see that SYS_MGR.FOCSET command
turns off messages to the screen. The SYS_MGR.ENGINE
command issues the insert statement directly to the RDBMS
Copyright 2007, Information Builders. Slide 10
Example
Lastly, display this included record and any error codes that
may have been received from the interface using the
SYS_MGR.dbms_errorcode command
Copyright 2007, Information Builders. Slide 11
Example
There was no problem including this record to the
database. However, if the name of a column was
misspelled you may receive an SQLCODE of 207.
Instead of the error being echoed to the screen, you
control what is displayed.
These are just some of the ways that you can
manipulate the database and environment from
inside of Maintain. A complete list of commands is
available online, search on SYS_MGR in Developers
Studio help.
Copyright 2007, Information Builders. Slide 12