3

I'm trying to set password of tFTPConnection component of Talend Open Studio using the context variable, but it's not working.

I'm getting this exception:

I've tried both reading context from file using context load and using context directly in the job


Exception in component tFTPConnection_1 (read_file_from_sftp_using_context)
com.jcraft.jsch.JSchException: Auth cancel
    at com.jcraft.jsch.Session.connect(Session.java:511)
    at com.jcraft.jsch.Session.connect(Session.java:183)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.tFTPConnection_1Process(read_file_from_sftp_using_context.java:2062)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.tFileInputDelimited_3Process(read_file_from_sftp_using_context.java:1776)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.tFileInputDelimited_2Process(read_file_from_sftp_using_context.java:1067)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.runJobInTOS(read_file_from_sftp_using_context.java:2550)
    at local_project.read_file_from_sftp_using_context_0_1.read_file_from_sftp_using_context.main(read_file_from_sftp_using_context.java:2345)
[statistics] disconnected

I expected that my connection will work but :(

Ram
  • 73
  • 1
  • 5
  • Hi Ram. Does the password work when it is directly set in the tFTPConnection component? Have you remove the double quotes for the String (or Password type) variables in the context? Have you special character(s) in your password which need to be escaped? – Mo2s May 14 '19 at 19:56
  • Hi @Mo2s, Thanks for asking. I tried by putting and removing the double quotes, didn't work. I also tried making the context as Password type still no relief. Yes the password has special characters, how should I escape them, as it has (! $ etc). BTW it works if I hardcode the password in Password field – Ram May 15 '19 at 06:26
  • Hi Ram. Thanks for your feedback. Use "\" to escape your special characters. Following characters may have to be escaped: <([{\^-=$!|]})?*+.>. Keep me informed. Thanks. – Mo2s May 15 '19 at 07:20
  • Hi @Mo2s, I tried escaping my password by adding backslash in front of the special character for e.g., "Password!" to "Password\!" but it didn't work. I was setting up my own sftp server on local machine that's why it took more time than expected to reply – Ram May 18 '19 at 08:31
  • Hi Ram. Thanks for your feedback. Please, perform the following test: in your Job, add a tJava componante with the code "System.out.println(context.your_context_variable);". Run the Job and check the password in the stack trace. Is the password OK? Thanks. – Mo2s May 20 '19 at 12:03

1 Answers1

2

I found the solution to the passing of password which contained special character semicolon(;). I was reading this, and found this statement:

Note the quotation marks around "noDatetimeStringSync=true" as it contains a Field Separator = character.

I tried that with the semicolon and it worked for me.

Thanks @Mo2s for your support as well.

Cheers, Ram

Ram
  • 73
  • 1
  • 5