Sumit Ghosh
Sumit Ghosh

Reputation: 39

Dynamic file paths in Talend job

I am using Talend Open Studio V5.4 for Data Integration.

Here is a brief description of the job I created in Talend:

I have created a job name Refresh_bFO_Table which connects to Salesforce.com and fetches data from Account and Opportunity tables and with that data it populates a local database named OFOTaccdb.

In this local database there are two tables bFO_Account and bFO_Opportunity which gets populated with the data retrieved from SalesForce.

Now, for connecting to SalesForce we have used OAuth2.0 for authentication. We have provided the consumerSecret, consumerkey, redirect uri in Talend tSalesforceComponent configuaration and jobs are running perfectly from Talend.

As of V5.4, Talend Open Studio supports OAuth2.0 for the component tSalesforceConnection. Now in this configuration of OAuth2.0, Talend asks for the following credentials:

To be noted I am making this application for an internal environment so I had given the Webservice URL as "test.Salesforce.com" not as "login.Salesforce.com".

Now as I mentioned above jobs are running perfectly from Talend but when I am exporting these jobs into VS2010. Then there is problem with token file path.We have created an UI for end user using Visual Basic. So after exporting these jobs from Talend we are putting them in the path C:\Users\SumitG\Documents\Visual Studio 2010\Olm-v2\Olm-test2\bin\Debug\Talend. Where olm-test2 is my VB project name. After this we making an .exe file of this VB project using Inno Setup compiler. We are creating this .exe file so every user can install it on their machine and use the VB interface to do necessary task.

When the user runs the installer, their installation goes fine but during invocation of Talend Job OAuth2.0 is not able to work as they don't get the Token file.

To overcome this problem I have put the token file in the installation directory so that it is provided to the user as well. But this creates a problem with this property: Token File=E:/OFOT_Workspace/token.properties as it will now no longer match the location of the OAuth2 token in the user's installation directory.

Is there any way by which I can make this token file path dynamic? I want it to always point to the installed directory.

Upvotes: 1

Views: 1856

Answers (1)

garpitmzn
garpitmzn

Reputation: 1011

Try using a relative path instead of your absolute path: Token File=E:/OFOT_Workspace/token.properties

This would be: Token File=../token.properties

Here when the Talend job runs it will search for file in one folder above the current location of .bat/.sh file and then try to open the .bat/.sh file which Talend generates and which you might be using for your job execution - it will have a relative path reference to .jar files in lib folder of Talend.

Upvotes: 2

Related Questions