“DBCPConnectionPool"服务不接受存储在属性中的值 [英] 'DBCPConnectionPool' Service Not accepting values stored in attributes

查看:21
本文介绍了“DBCPConnectionPool"服务不接受存储在属性中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我使用的处理器组合:-

Following are the combination of processors that I am using:-

GetFile + SplitText + ExtractText + UpdateAttribute + ExecuteSQL + ConvertAvroToJson + PutFile 

基本上,我有一个属性文件,其中包含DBCPConnectionPool"控制器服务与数据库建立连接所需的 5 个逗号分隔值.这是我的属性文件的内容:-

Basically,I have a properties file which contains 5 comma separated values that are required by the 'DBCPConnectionPool' controller service to establish connection with the database. Here is the content of my properties file:-

jdbc:mysql://localhost:3306/test,com.mysql.jdbc.Driver,C:\Program Files\MySQL\mysql-connector.jar,root,root

现在,我正在从此属性文件中提取值并将它们存储在手动创建的属性中.我正在使用此正则表达式将这些值存储到使用 ExtractText 的属性中.

Now, I am extracting the values from this properties file and storing them in manually created properties.I am using this regex to store that values into attributes using ExtractText.

ExtractedData: (.*)

然后使用 updateAttribute 处理器手动添加 5 个属性并从属性文件中获取它们的值,如下所示:

Then use updateAttribute processor to manually add 5 properties and get their values from the properties file like below:

connectionURL  : ${ExtractedData:getDelimitedField(1)}
driverClass    : ${ExtractedData:getDelimitedField(2)}
driverLocation : ${ExtractedData:getDelimitedField(3)}
user           : ${ExtractedData:getDelimitedField(4)}
password       : ${ExtractedData:getDelimitedField(5)}

所以,现在属性已经从属性文件中获取了它们的值,因此以下值存储在它们中:

So, by now the attributes have got their values from the properties file and thus following values stored in them:

connectionURL  : jdbc:mysql://localhost:3306/test
driverClass    : com.mysql.jdbc.Driver
driverLocation : C:\Program Files\MySQL\mysql-connector.jar
user           : root
password       : root

最后,这就是我想要实现的目标.我正在尝试在 DBCPConnectionPool 控制器服务中使用上述 5 个属性,如下所示:

Finally, Here is what I am trying to achieve. I am trying to use these above 5 attributes in the DBCPConnectionPool Controller Service like this:

 Database Connection URL     : ${connectionURL}
 Database Driver Class       : ${driverClass}
 Database Driver Location(s) : ${driverLocation}
 Database User               : ${user}
 Password                    : ${password}

但我无法建立连接,并且收到错误无法创建 PoolableConnectionFactory".似乎控制器服务无法从属性中读取值.如何将流文件属性传递给控制器​​服务?

But I am unable to establish the connection and I am getting the error 'Cannot create PoolableConnectionFactory'. It seems that the controller service is unable to read the value from the attributes. How can I pass a flowfile attribute to a controller service?

推荐答案

'DBCPConnectionPool' Service Not accepting values stored in attributes

那不是问题.这是一个功能)

That's not an issue. This is a feature )

到控制器服务启动时建立的数据库连接,而不是传递给 dbcp 处理器的流文件.

Connection to the database established on controller service start and not on flow file passing to the dbcp processor.

这篇关于“DBCPConnectionPool"服务不接受存储在属性中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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