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();
您是否尝试过jobMeta.activateParameters()?
看来jobMeta.activateParameters()
似乎不起作用,这是动态传递连接所需的全部,但是job步骤未按如下所示选择参数化名称:
<connection>${kettle.db.connection.name}</connection>
您无需动态传递数据库名称,而使用通用连接将所有数据库连接属性动态传递给水壶作业。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.