Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
David_Beaty
Specialist
Specialist

[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
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

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

5 Replies
Anonymous
Not applicable

Hi David,
I think you can probably use thissolution 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.

David_Beaty
Specialist
Specialist
Author

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.
Anonymous
Not applicable

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);
}
Anonymous
Not applicable

Glad it helped Andrew 🙂
billimmer
Creator III
Creator III

This is great! It dynamically changes the "use existing connection" value for all of the ftp components in the job from one fFTPConnection to another.