0% found this document useful (0 votes)
469 views50 pages

CB1PRAFJ Lesson5 DBTools

This document provides an overview of the DBTOOLS lesson within the TAFJ Foundation course. It describes the key features and functionality of the TAFJ-DBTools Console, including executing SQL, JQL, and OFS commands to load and extract data from databases, view database locks, and view table statistics. It also provides instructions on setting up users to access the DBTools Console and details the different modes and panels within the Console interface.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
469 views50 pages

CB1PRAFJ Lesson5 DBTools

This document provides an overview of the DBTOOLS lesson within the TAFJ Foundation course. It describes the key features and functionality of the TAFJ-DBTools Console, including executing SQL, JQL, and OFS commands to load and extract data from databases, view database locks, and view table statistics. It also provides instructions on setting up users to access the DBTools Console and details the different modes and panels within the Console interface.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

1

Welcome to the lesson DBTOOLS of the TAFJ Foundation course

2
3
In this lesson we will see
DBTools console
Execute JQL, SQL, OFS commands
Load and extract data from the Database
View Database Locks
Enquire about the table statistics

4
• TAFJ-DBTools Console is an unique application that gives user the ability to launch
SQL / JQL statements, and integrate the various database related TAFJ tools.
• It is also designed to help users to launch various commands in a quick and
efficient way by providing aliases and history functionalities. It gives different
options to display query results. It’s built upon the TAFJ-Core framework to be
independent of any native libraries.

5
• TAFJ-DBTools can be accessed only by authenticated users. Username and
password has to be passed as parameters to DBTools. Create a valid user using
tUserMgnt.bat/tUserMgnt.sh.
• Run from %TAFJ_HOME%\bin: tUserMgnt.bat or tUserMgnt.sh depending on the
platform.
• It works in 3 modes
• --Add : to add a new TAFJ user
• --Reset : TAFJ blocks the user when the user credential is used with
incorrect password for 3 attempts. A blocked user cannot be used until the
user is reset with a new password or deleted/re-created. Password can be
reset with this option
• --Del : to delete an existing user
• Use the –u Username to supply a preferred user name and –p Password to supply
a preferred password. The username and encrypted password is stored in a
.dbtools.security file in %TAFJ_HOME%\conf folder
• Once a user is created, you can login and access DBTools and tJed wizard
commands. Pass the username and password along with –u and –p option
respectively.

6
• DBTools Console can be launched from %TAFJ_HOME%\bin.
• DBTools [-cf <configuration>[.properties]] –u <un> -p <pwd>

• The targeted database will be the one defined in the default configuration file or in
the configuration file specified by the -cf option.

• DBTools console consists of three panels:


• Header panel that contains information about the current mode or running
command
• Main panel that contains the result of the last executed command
• Footer panel that contains the command line
• When DBTools is launched, you can view the DBTools HELP document
automatically launched in the main panel. Alternatively, type HELP at the footer.

• Note: Copy the database specific jar files from


%TAFJ_HOME%\dbdrivers\<database driver>\ folder to %TAFJ_HOME%\ext
folder, if not already done.

7
Header
The header presents the following information:
• The current mode or running command. For e.g. JQL, SQL or HELP
• A warning in case of unrecognized command
• The current page / column number and the total number of page / column if the
result of the command is being displayed on multiple page and/or columns.
• In SQL Mode, you will in addition also see the auto-commit status. By default it is
set to off

8
Main panel
• The main panel contains the command result to be displayed or edited. It is
displayed in columns and rows.
• If the length of the result set of a command is greater than the console’s maximum
column length (80 characters by default), then only the first 80 characters are
displayed in the first column, the remaining data is wrapped to the next column
i.e., 2. In the example shown we can see column 1/7. Type sr at the command
prompt to scroll right to next column and sl to scroll left.
• If the result set of a command executed has more rows than the console’s default
(20 rows) it will be displayed on multiple pages. Type f to move forward to next
page and b to move backward.
• The result set of the below Select is displayed on 2 pages and 7 columns as seen in
the snapshot
SELECT
RECID,RANK,CCY_NAME,NUMERIC_CCY_CODE,BUY_RATE,SELL_RATE,COUNTRY_COD
E,BASE_CCY_RANK,NO_OF_DECIMALS, THE_RECORD FROM V_FBNK_CURRENCY

9
Footer
• The footer panel contains the command line from where the DB commands can be
issued.
• The footer also shows by default the database connection parameters: user name,
database name and hostname IP address.
• For command results that can be edited (for e.g. editing a record), the field
number is displayed on the left margin of the panel adjacent to the data. Type the
field number on the command line in the footer to make the corresponding data in
the field editable as shown.

10
Launch the DBTools console and navigate the help document using the navigation
commands available

11
We will first look at all the database functionalities available on the DBTools Console
• Execution Modes - SQL, JQL, OFS
• Execute JED application (edit and modify record)
• Extract and load data from and to a database
• Show current locks and release locks on database
• Display table statistics

12
The console operates in SQL/JQL/OFS modes
SQL
To execute SQL statements, you must switch to SQL mode by typing command “SQL”
on the command line or by prefixing your SQL command with SQL keyword. The
header panel displays the keyword SQL to confirm that SQL mode is activated. The
console is now ready to execute SQL statements.

The allowed SQL statements are listed on the slide. To be recognized the statement
must start with one of the keywords in uppercase: For e.g. SELECT * from
FBNK_CURRENCY. To know the actual table name of a T24 table in the RDBMS, type
JQL GETDBNAME <VOC file name>.

By default the database connection is set to auto-commit=false. An explicit COMMIT


is needed after any DML execution using the COMMIT statement. Otherwise, the
changes made will be roll backed on exiting the console.

13
If a DML statement returns a result set, then the result set is displayed. Else the
number of rows affected by the statement is displayed.

SQL Exceptions are displayed on the console. To avoid excessive memory usage when
retrieving important set of data, by default only the first 200 rows are displayed. Use
setup to modify the defaults.

14
• Display CURRENCY records in the SQL mode
• List the allowed commands in the SQL mode

15
JQL
• To execute JQL statements, first you have to enter JQL mode by typing command
“JQL” on the command line or by prefixing your JQL command with JQL keyword.
JQL mode gets activated and is displayed in the header panel. The console is now
ready to execute JQL statements. The allowed keywords are displayed in the slide.
Use the command USAGE at the footer to get this list.
The CREATE-FILE command can be used to create tables of XML,CLOB,BLOB,MULTI-
COLUMN,VARCHAR types.
CREATE-FILE F.TESTROFILE TYPE=<<TYPE>>
To specify MULTI-COLUMN file creation, an existing dictionary is needed,
CREATE-FILE FBNK.CURRENCY.2 TYPE=MULTI-COLUMN DICT=D_F_CURRENCY
CHANGE-TABLETYPE
• In addition to these modes the CHANGE-TABLETYPE statements will allow you to
change a table type from one type of data storage to another (example, from XML
to CLOB, or vice-versa) while moving the existing data to the new format. A
backup file is created with the original data named with the suffix .BACKUP of the
target file. This backup file is deleted finally. Types currently supported are XML,

16
CLOB, BLOB, and VARCHAR.
CHANGE-TABLETYPE TABLE=FBNK.CURRENCY FROM=XML TO=CLOB

16
• Use GETDBNAME
• Use LIST-ITEM along with the WITH clause

17
OFS
• To execute OFS statements, type “OFS” on the command line or by prefix your OFS
command with OFS keyword. The default OFS source is GCS.

[Note: Your TAFJ default properties file must point to a valid T24 precompile directory
or jars

18
• JQL2SQL mode give the SQL equivalent statements for JQL statements

19
• You can call JED console to display and edit database records by using command
JED <<FILE NAME>> <<RECORD KEY>>

20
• The option –s, executes JED command in the script mode. The script mode can be
used to directly update a record without opening JED Console.

• JED -s <<FILE NAME>> <<RECORD KEY>> <<FIELD NUMBER>>=<<VALUE>>;

21
Extract table
• This EXTRACT-TABLE command extracts records from a table and writes them on
the local file system. The options are
• -f : file mode (default) - one file per record, the name of the file has the format
<filename>-<recordId>
• -d : directory mode. – creates a directory with the table name and inside this
directory each record will be stored in a distinct file. The file name is the record id
itself. If any file or directory already exists, they will be overridden.

Load data
• This LOAD-DATA command loads data from your file system into the database. You
can load a single record at a time or specify the directory itself as a parameter to
load a set of records
• -f : file mode (default) . The file name has the format <filename>-<recordId>. If the
file passed is a directory, all files having the previous format will be processed
• -d : directory mode. The parameter must be a directory. This directory will be

22
recursively processed until a file is found.
• To load a single record from a file on your file system – LOAD-DATA
/CURRENCY/FBNK.CURRENCY-AUD where FBNK.CURRENCY-AUD is a file in the
CURRENCY directory
• To load a set of records from a directory on your file system – LOAD-DATA
/CURRENCY/FBNK.CURRENCY where FBNK.CURRENCY is a directory containing
individual files for each record in the FBNK.CURRENCY table.

22
• LOCKS command displays all records locked in the database. It displays locks
managed by one of the below locking modes
• tLockManager
• JDBC (TAFJ_LOCKS table) – above screenshot
• ORCL/MSSQL
• DATABASE internal locking on the database.
• The different lock modes are discussed in the session on TAFJ lock manager.

• The RELEASE locks command is specially designed for tLockManager. It is used to


release the locked record from tLockManager.

• View the currently locked records by launching command LOCKS and release the
record you want using the command RELEASE <<FILE NAME>> <<RECORD ID>>

• Note: With ORCL and MSQL locking, it is not possible to release locks because
DBTools does not own the database session where the lock was taken. It is not
possible to release locks that are taken with SELECT FOR UPDATE when the locking
mode = DATABASE

23
This command gets information about a JBase file, its file path, its H2 equivalent
database filename and record count.
Syntax - STAT <<FILE.NAME>>

24
We shall look at all the console functionalities
• Command History
• Create, execute and delete aliases
• Setup command

25
• A history of last commands launched (10 last commands by default) is maintained
to give the ability to reuse quickly last used command.

• Simply enter “history” on the command line. You will get the resulting output that
shows the list of last used commands.

• Whether you are under history mode or not you can recall the command you want
by typing its history index on the command line. i.e. you want to recall last SQL
command just type h1 and you will get that command executed.

• You can clear history by typing the command clear-history.

26
DBTools Console also provide an “alias” functionality to reuse complex command
efficiently.
For example you often use the same JED statement to setup F.TSA.SERVICE, record
COB, status to “START” and number of AGENT to “TEN”
E.g.: JED –s F.TSA.SERVICE COB 3=TEN;6=START;
You can create an alias to create a shortcut to this command by typing :
alias <<ALIAS NAME>><<BLANK>><<COMMAND>>

Display aliases
To display all stored aliases you can type command “aliases”

Execute an alias
To execute this command just type the alias name on the command line.

27
• If you create an alias for a SQL or JQL statement you have to switch to the
appropriate mode before calling the alias or the command won’t be recognized.

• In the snapshot shown invoking CURRLIST in the JQL mode does not yield the
result set as CURRLIST is an alias for an SQL command. Hence switch to the SQL
mode before executing the alias.

• You can also add select criterion to your alias.

• To delete an existing alias just type command unalias <<ALIAS NAME>>

28
The setup command allows you to customize your session by manipulating a list of
properties. These properties are specified in the DBTools properties file. As with all
property file there is only one DBTools.properties file for your TAFJ area and is shared
between all users.

Max row retrieved ( SQL) - This property allows you to customize the maximum
number of rows that would be retrieved from a SQL SELECT statement.
This prevents memory exception in case the SQL query yields a large result set. Value
should be an Integer, default value is 200.

Max records per page - This property allows you to customize the maximum number
of results that would be displayed in the main panel.
Value should be an Integer, default value is 20. Make sure your console is correctly
sized to display the requested number of records.

Max line length - This property allows you to customize the maximum line length

29
(i.e., columns) that would be displayed in the main panel.
Value should be an Integer, default value is 80. Make sure your console is correctly
sized to display the full line length.

29
• DBTools Console gives also the ability to launch the console along with a
command. Add your command to the command line when launching DBTools
console
• DBTools [-cf <configuration>[.properties]] –u <un> -p <pwd> COMMAND
• Now the console opens with the result set of the command.
• Execution in script mode
• DBTools console allows you to execute the same commands that you execute in
the interactive mode, in a script mode. In the script mode the command gets
executed against the running database without opening the console.
DBTools –u <un> -p <pwd> –s JQL CLEAR-FILE F.EB.EOD.ERROR
DBTools –u <un> -p <pwd> –s SQL INSERT INTO MY_CURRENCYFILE VALUES
(‘USD’, ‘THE_RECORD’)
Note: Use the escape sequence \\ when using *

31
When you execute a command in DBTools console, the result set is buffered and
displayed on the console by default. Even when you use the script mode –s, the
command execution result set is displayed on the command window without opening
the DBTools console. This output form is suitable for commands that does not
produce large execution reports or result sets.

Log mode: execution report is append in a log file


a) On providing -log logFileName along with –s, the execution report will be
redirected to the specified log file. This file is generated with .log extension under
%TAFJ_HOME%\log
DBTools –u <un> -p <pwd> -s -log currencyId SQL SELECT RECID FROM
FBNK_CURRENCY will redirect the output to %TAFJ_HOME%\log\currencyID.log
b) In DBTools console use the Setup command to specify the log file. Then the
execution report will be displayed on the DBTools console and also redirected to the
log file. Use the SPOOL command to turn on spool to redirect output to the log. To
turn off SPOOL, type SPOOL once again at the footer prompt. This way you can
control for which commands you want to log the output.

32
Silent mode: no execution report
You can use the -silent option in script mode to silence the execution report It could
be useful for commands appending a lot of output during execution.

32
1. Use LIST-ITEM in JQL mode or use SELECT in SQL mode.
DBTools -u <un> -p <pwd> -s SQL SELECT \\* FROM
F_STANDARD_SELECTION WHERE RECID='CUSTOMER‘
DBTools -u <un> -p <pwd> -s JQL LIST-ITEM F.STANDARD.SELECTION
CUSTOMER

2. DBTools -u <un> -p <pwd> -s JQL CLEAR-FILE F.BATCH.STATUS

3. DBTools -u <un> -p <pwd> -s JED –s F.TSA.SERVICE COB 6=STOP;

33
The TAFJ-JED application is designed to edit and modify database records by providing
their file name and record key.

Like the DBTools console the JED console is also built upon TAFJCore framework to be
independent of any native libraries. It could be called from DBTools console as seen
earlier and in standalone mode too.

Execution – Interactive mode


JED Console could be launched from %TAFJ_HOME%\bin.

tJed [-cf <configuration>[.properties]] –u <un> -p <pwd> <file name> <record key>


The targeted database will be in the configuration specified by the -cf option or the
one defined in the default configuration file.
The command list given at the bottom of the screen allows you to navigate in the
console and is similar to the DBTools console.

34
JED console consists of three panels like the DBTools console:
Header panel that contains information about the record
Main panel that contains the record to be edited
Footer panel that contains the command line
Header - The header presents information related to the edited record:
File name Record key Record ‘lock’ status : the value could be UNLOCKED
(default) / LOCKED ( if the LOCK parameter is provided in the tJed command)
Main panel - The main panel contains the record to be displayed. The record is
displayed vertically. Each field is displayed in a row. Each row displays a number that
correspond to a single value field no (i.e., 11 is FREQUENCY field), a multi-value field
with its MV position (i.e. 15.5 is the fifth multivalued Date field) or a sub-value field
no with the SV position (i.e.1.1.1).
The field number is displayed on a margin on the panel left; the field data is displayed
adjacent to the margin
JED console can display 80 characters per row, by default the margin is 5 characters
long and so the data part 75 characters long.
Footer - The footer panel contains the command line. You can see some of the
available commands listed on the command line.
[note: -cn option is discussed later]

35
Insert a field / Multi-value / Sub-value
To insert a new field, multi-value or sub-value just type the command i followed by
the <field position>:<multivalue position>:<subvalue position> number on the
command line.

Delete a field / Multi-value / Sub-value


To delete a field, type the command d followed by the <field position>:<multivalue
position>:<subvalue position> number on the command line. The fields, multi-values,
sub-values that follow the deleted field will be renumbered.

36
Delete a record
You can delete a record by typing command d. You will be asked for confirmation.

37
Optional parameters
Fields per page number - By default JED console is configured to display 20 fields per
page.
By providing option line: –l <fields per page number> you will be able to change
dynamically this property. Please ensure that your terminal is correctly sized to
display the number of line required or the data won’t be displayed properly.

Column names - By default JED console is configured to display a record with no field
name. By providing the column name option: -cn you will be able to retrieve the
record field names if they are defined in the related T24 application. Since field
names are also displayed in the margin, the display length of the field data will be less
than 75 characters. Type cn at the command line to toggle between display/hide field
names.

38
help - Use the help option to display the available functionalities on the JED console -
help
tJed –u <un> -p <pwd> -help F.VERSION TELLER,ACCT.TFR
LOCK - By default JED console will read the requested record with no lock on it. To
perform a readu , provide the LOCK parameter with value Y.
tJed –u <un> -p <pwd> F.VERSION TELLER,ACCT.TFR LOCK=Y
JED Graphical mode - By providing option graphical user interface: -gui you will be
able to launch JED in graphical mode. Useful when your T24 area does not have a
VT100 console. However on Unix systems X Windows must be installed for launching
the gui.
tJed –u <un> -p <pwd> -gui F.VERSION TELLER,ACCT.TFR
[Note: use a windows command prompt to launch the gui console. -gui will not
display correctly from a vt100 console.]

39
Execution - script mode
It is also possible to modify a record without opening it in JED console from command
line. This is referred to as the “script mode”.
To update the record add ‘-s’ to the command along with the field(s) number you
want to change and provide the associated values.
Example
To change in file F.TSA.SERVICE, COB record, field value number of agent
(WORK.PROFILE) and
service status (SERVICE.CONTROL), you have to do the following:
On Windows – tJed –u <un> -p <pwd> -s F.TSA.SERVICE COB 3=TWO;6=START;
On UNIX (use quotes)- tJed –u <un> -p <pwd> -s ‘F.TSA.SERVICE COB
3=TWO;6=START;’
The record will get updated without opening the console. It also works for multi-value
and sub-value fields. i.e. tJed –s MY.FILE MYRECORD 1.1=VM;2.1.1=SM;
tJed –u <un> -p <pwd> -s F.TSA.SERVICE COB 3=TWO;6=START;
It also works for multi-value and sub-value fields. For e.g. tJed –s MY.FILE MYRECORD
1.1=multivaluefield;2.1.1=subvaluefield;

40
Change column mode – Fields with values greater than the display length in the
column, are split and displayed across multiple columns. Toggle the column mode, to
display such field data in multiple lines in the same column.

Type help at the command line for a valid list of commands to use on the JED console

Type x at the command line to exit the console.

41
• tJed -u admin -p Temenos@123 -gui FBNK.CUSTOMER 100100 LOCK=Y

42
43
1. DBTools
2. tUserMgnt
3. SQL, JQL, OFS
4. LOCKS
5. STAT

44
In this lesson, we saw usage of the DBTools utility in TAFJ

45
46
47

You might also like