[resolved] tFTPConnection configuration as FTP or SFTP - possible?

Highlighted
Nine Stars

[resolved] tFTPConnection configuration as FTP or SFTP - possible?

Hi all,
I have a job with a tFTPConnection component which uses values for which server to connect to as dynamic content read in from a parameter file. However, I now find that some connections I are port 21 and just normal FTP, others are port 22 and SFTP.
How can I configure either the tFTPConnection component to change the SFTP Support and Authentication Method as they are not text boxes to put something like a "context.SFTPSupport"? Alternatively, if I have multiple tFTPConnection components, one for each connection style ( FTP, SFTP wth password, SFTP with public key) how can I get the other FTP components, get, put list, rename, etc. to dynamically switch between the 3 connections?
Thanks
David
Regards David
Dont forget to give Kudos when an answer is helpful or mark the answer as the solution.

Accepted Solutions
Highlighted
One Star

Re: [resolved] tFTPConnection configuration as FTP or SFTP - possible?

Genius! This helped us out greatly in getting our SFTP configured - we need this because we wanted dynamic connections but some use Password Authentication and others use Public Key and that couldn't be paramaterized. Here's the code we used in our tJava component:
if(context.use_Private_key.equals("")){
    com.jcraft.jsch.ChannelSftp c_tFTPConnection_2 = (com.jcraft.jsch.ChannelSftp)globalMap.get("conn_tFTPConnection_2");
    globalMap.put("conn_tFTPConnection_1", c_tFTPConnection_2);
}

View solution in original post


All Replies
Highlighted
Community Manager

Re: [resolved] tFTPConnection configuration as FTP or SFTP - possible?

Hi David,
I think you can probably use this solution for doing the same thing with DB Connections. Instead of using the following code....

if(!context.UseSID){
    java.sql.Connection conn_tOracleConnection_2 = (java.sql.Connection)globalMap.get("conn_tOracleConnection_2");
    globalMap.put("conn_tOracleConnection_1",conn_tOracleConnection_2);
}


....it would be something along the lines of this...

if(!context.UseSID){
  com.enterprisedt.net.ftp.FTPClient ftp_tFTPConnection_2 = (java.sql.Connection)globalMap.get("conn_tFTPConnection_2");
    globalMap.put("conn_tFTPConnection_1",ftp_tFTPConnection_2);
}


I'd be interested to know if this works. Looking at the code it should, but I haven't been able to test it as I don't have access to the required ftp locations.

Highlighted
Nine Stars

Re: [resolved] tFTPConnection configuration as FTP or SFTP - possible?

Thanks for the ideas Richard, in the end I created my own tFTPConnection component that had the tickbox for sFTP support as a piece of text that I could that assigned a context or global variable.
I couldn't create my own custom named version, as all of the other tFTPxxxxxx components only connect to a tFTPConnection component only - so it had to be called tFTPConnection.
It worked, but it wasn't pretty. Once I got that working, the client secured all environments to be sFTP so had to revert it all anyway.
Regards David
Dont forget to give Kudos when an answer is helpful or mark the answer as the solution.
Highlighted
One Star

Re: [resolved] tFTPConnection configuration as FTP or SFTP - possible?

Genius! This helped us out greatly in getting our SFTP configured - we need this because we wanted dynamic connections but some use Password Authentication and others use Public Key and that couldn't be paramaterized. Here's the code we used in our tJava component:
if(context.use_Private_key.equals("")){
    com.jcraft.jsch.ChannelSftp c_tFTPConnection_2 = (com.jcraft.jsch.ChannelSftp)globalMap.get("conn_tFTPConnection_2");
    globalMap.put("conn_tFTPConnection_1", c_tFTPConnection_2);
}

View solution in original post

Highlighted
Community Manager

Re: [resolved] tFTPConnection configuration as FTP or SFTP - possible?

Glad it helped Andrew :-)

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog