Database and table management
This simple recipe shows how to execute database management and table related commands.
Getting ready
Create a new job jo_cook_ch07_0100_tableManagement
.
How to do it…
The steps to be performed are as follows:
Drag the
cookbookDB
connection onto the canvas and select the componenttMysqlRow
.In the Query area add the following code:
" CREATE TABLE `test_mysqlrow` ( `id` int(11) NOT NULL, `data` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`) ) "
Run the job and you will see that the table
testMysqlRow
has been created.
How it works…
The tMysqlRow
component is the database equivalent of both tJava
and tJavaRow
, it can be used within a flow like tJavaRow
or standalone like tJava
.
That said, the tMysqlRow
component is most commonly used standalone, like tJava
, as in this case, where we create a table.
There's more…
This simple example shows a single, isolated use of tMysqlRow
. On most occasions it is used prior to processing to create temporary tables or to drop constraints...