cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Periodically read data from FTP server and insert/update data into database

cchinh
1-Newbie

Periodically read data from FTP server and insert/update data into database

Hello guys,

I'm very new to Thingworx IOT platform. Presently, I'm encountering a problem which is how to read data from ftp periodically and update into H2 database.

Btw, I know that Thingworx has an extension called FTPExtension used to connect to FTP server

My questions:

1. Is this possible that Thingworx can read FTP data every 5 minutes?

2. After get files in FTP server, I want Thingworx delete or rename those files, so the next time Thingworx get only new files. Do I need to develop some kind of service?

3. How can Thingworx parse ftp data(text files) and update to H2 database?

Thanks in advanced

1 ACCEPTED SOLUTION

Accepted Solutions
supandey
19-Tanzanite
(To:cchinh)

Hi Chinh, if your ThingWorx's default persistence provider is H2 then all the data that you are storing will automatically go to H2. So for e.g. if you are using a Datatable to store the parsed data in a DataTable it will be stored automatically in the H2 DB so you don't have to do anything specificly about storing data in H2.

Now coming to your first question I'm not aware if there's any out of the box service for parsing text files, but you can create one and using a Scheduler or a Timer thing depending on the use case you can call that service to perform FTP transfer and also check in the process whether or not that file has been processed previously or not.

Hope this helps to clarify the situation to some extent

View solution in original post

3 REPLIES 3
supandey
19-Tanzanite
(To:cchinh)

Hi Chinh, if your ThingWorx's default persistence provider is H2 then all the data that you are storing will automatically go to H2. So for e.g. if you are using a Datatable to store the parsed data in a DataTable it will be stored automatically in the H2 DB so you don't have to do anything specificly about storing data in H2.

Now coming to your first question I'm not aware if there's any out of the box service for parsing text files, but you can create one and using a Scheduler or a Timer thing depending on the use case you can call that service to perform FTP transfer and also check in the process whether or not that file has been processed previously or not.

Hope this helps to clarify the situation to some extent

Hi Sushant Pandey, Thanks for answering the question.

Could you clarify the way to process FTP files , any thingworx tutorials regarding this issue?

Thanks

supandey
19-Tanzanite
(To:cchinh)

Hi Chinh do you mean the usage of these available services with the FTP extension? There are tutorials available if you are planning to use the FTP capability from one of the EDGE SDKs of ThingWorx for e.g. if you are exploring the ThingWorx Java EDGE SDK you can check the sample code available there you can check the details here for  ThingWorx Java Edge SDK

Top Tags