将 DB Connection 参数传递给 Kettle,也就是 PDI 表 从 Excel 动态输入步骤 [英] Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel

查看:14
本文介绍了将 DB Connection 参数传递给 Kettle,也就是 PDI 表 从 Excel 动态输入步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,每当我运行 Kettle 作业时,必须在每次运行时从 Excel 源动态获取数据库连接参数.

I have a requirement such that whenever i run my Kettle job, the database connection parameters must be taken dynamically from an excel source on each run.

假设我有一个列名的 excel:主机名、用户名、数据库、密码.

Say i have an excel with column names : HostName, Username, Database, Password.

我想在作业运行时动态地将这些连接参数传递给我的表输入步骤.

i want to pass these connection parameters to my table input step dynamically whenever the job runs.

这就是我想要做的.

推荐答案

您可以通过

  • 从源(例如 Excel 或在我的示例中为 CSV 文件)读取数据库连接参数
  • 将参数存储在变量中
  • 使用连接设置中的变量.

按以下步骤进行

  • 创建另一个用于设置变量的转换(您不能在使用它的同一个转换中执行此操作):

Set Variables 元素中配置变量:

In the Set Variables element configure the variables:

  • 在读取/写入数据的元素中创建一个新连接并使用 ${variable_name} 设置连接参数.请注意,您必须盲目地将 ${password} 写入适当的字段.另请注意,这可能是一个安全问题,因为该值可能会在日志文件中显示为纯文本!
  • In the element reading/writing your data create a new connection and set the connection parameters using ${variable_name}. Note that you have to blindly write ${password} into the appropriate field. Also note that this may be a security issue because the value may show up as plain text in log files!

  • 在您的工作中,首先调用变量转换,然后调用函数部分:

这篇关于将 DB Connection 参数传递给 Kettle,也就是 PDI 表 从 Excel 动态输入步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆