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

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

问题描述

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

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

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

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

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".似乎控制器服务无法从属性读取值.如何将flowfile属性传递给控制器​​服务?

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天全站免登陆