2
votes

I have one Kettle job which will get data from database X and copy the data to another database Y.

I have used some Kettle jars to run this job from java and its working fine.

Now, my requirement is, how can i pass Database name to job from java dynamically?

Example:

String filename = "myJob.kjb";
KettleEnvironment.init();
JobMeta jobMeta = new JobMeta(filename, null);
jobMeta.setParameterValue("TEST_DB", "MyDatabase");
jobMeta.setInternalKettleVariables();
Job job = new Job(null, jobMeta);
job.start();
job.waitUntilFinished();
3

3 Answers

0
votes

Did you try jobMeta.activateParameters() ?

0
votes

It appears that jobMeta.activateParameters() doesn't seems to work, what all is required to pass connection dynamically, however job step does not pick the parametrized name as follows:

<connection>${kettle.db.connection.name}</connection>
0
votes

You do not need to pass db name dynamically use generic connection pass all db connection properties dynamically to kettle job.