Welcome Guest! Log in


This project describes how to manage multiple source databases using parameters in the jdbc URL.

To download the sample project click here.

Detail

Before starting

Start the runtime and the demo databases

Preparing the environment

Create a new configuration called "Look42601"

Launch the three database servers in the folder "2.0 Databases", using the three following commands

  • h2Server_42601.bat
  • h2Server_42602.bat
  • h2Server_42603.bat

Create the delivery for the process "InitData"

 

Launch the process "Init databases" in the folder

 

Here is the expected result of the execution :

 

At this point, you should see three new files in the "temp" folder of the Stambia Runtime :

- Database42601.h2.db

- Database42602.h2.db

- Database42603.h2.db

They are three new databases with data.

 

Using the project

You can look now at the example with the two processes "Child" and "Master".

The first process "Child" will only read data in the "SOURCE" table and create a flat file with it

The second process "Master" will call the "Child" process for each database created in the preparation step.

The metadata

As you can see, the metadata in the "SourceH2Database.rdbms.md" file has a parametrized URL : "jdbc:h2:tcp:${~/URL_BASE}$/temp/${~/URL_DATABASE_NAME}$"

(click on the metadata file)

(click on the root of the file you opened)

(look at the properties)

 

The parameters of the URL will be filled by the "Master" process before it calls the child process.

The Master process will loop on the LST_SOURCES table which contains the information, and launch the Child process for each row.

The data

Take a moment and look at the LST_SOURCES data table.

To do that, you should select the "Look42601" configuration

As you can see in the metadata file, this configuration is set on the first database :

If you consult the data, you will see the configuration table on which the master process will loop :

 

 

The child process

Take a look now at the child process.

 

Its content is very simple. Just one step !

 

This step will write a file the name of which will depend on the parameters given by the master process.

The variable CORE_TEMPORARY_FOLDER gives us the temporary folder of the Stambia runtime.

The URL_DATABASE_NAME variable is the parameter given by the master process.

The master process will publish the variable on the top father process (the process home).

So, to get the variable you should use a "~/" prefix.

 

The Master process

The master process is made of two steps, linked by a "direct bind" link.

 

The first step is a select on the LST_SOURCES table.

 

The second step is a call of the child delivery.

Be careful : the child delivery should have been created (compilation) before being able to use it !

You can see that one standard parameter is set with a column of the select operation. The session name will change for each child session :

 

At the same time, two new parameters are created on the "Execute Delivery" Operation :

 

These two parameters will be those given to the child process.

The execution of the master process should give the following result :

 

 

 

 

You have no rights to post comments

Articles

Suggest a new Article!